qtableview 复选框 图标 合并单元格 我现在使用一个qtableview显示数据,需要在第一列显示一个图标和复选框, 显示图标时,我使用 QStandardItem ( const QIcon & icon, const QString & text ) 运行时提示: QPixmap: It is not safe to use pixmaps outside the GUI thread 还有就是如何同一行上的多个单元格, 用setSpan()不起作用? 这个函数如何使用?
十五.设置qtableview中列宽 tableViewCustomer->setColumnWidth(0, 60); tableViewCustomer->setColumnWidth(1, 55); tableViewCustomer->setColumnWidth(2, 70); tableViewCustomer->setColumnWidth(3, 50); tableViewCustomer->setColumnWidth(4, 80); tableViewCustomer->setColumnWidth(5, 80); tableViewCustomer->setColumnWidth(6, 70); tableViewCustomer->setColumnWidth(7, 100); tableViewCustomer->setColu...
十四.获取qtableview中鼠标选择行信息 QModelIndex index = tableViewCustomer->currentIndex(); 然后通过queryModelCustomer.record(index.row()).value("customerid")可获得选择行在数据库中的相关信息(queryModelCustomer为tableViewCustomer中setModel(&queryModelCustome)设置的QSqlQueryModel 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/37292/showart_287666.html
十三. 在qtableview中设置点击各标题排序 queryModelGoods.sort(0); QHeaderView *headerGoods = tableViewGoods->horizontalHeader(); //SortIndicator为水平标题栏文字旁边的三角指示器 headerGoods->setSortIndicator(0, Qt::AscendingOrder); headerGoods->setSortIndicatorShown(true); headerGoods->setClickable(true); connect(headerGoods, SIGNAL(sectionClicked(int)), tableViewGoods, SLOT (sortByColumn(int))); ...