stella1016
23rd March 2012, 12:52
I have a QTableWidget which provides multi-row-selection property. Now new requirement is that partial rows should be grayed out, and the user can not select them.
For QTableWidget, I set:
ui.tableWidget->setSelectionMode(QAbstractItemView::MultiSelection );
ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows );
How could I disable the selection of certain rows of this table? Thanks in advance.
Added after 11 minutes:
Ha, I found the answer:
QTableWidgetItem::setFlags(Qt::NoItemFlags) solves my problem! ;)
For QTableWidget, I set:
ui.tableWidget->setSelectionMode(QAbstractItemView::MultiSelection );
ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows );
How could I disable the selection of certain rows of this table? Thanks in advance.
Added after 11 minutes:
Ha, I found the answer:
QTableWidgetItem::setFlags(Qt::NoItemFlags) solves my problem! ;)