I want to select a row in QTableWidget by clicking on it, but when my row contains a cellWidget, the selection change event will be triggered when there is no click (for example: the mouse moves in the Table).
Should I receive the ItemClicked signal myself to handle it? Selected? Or is there any other better way?
This is part of my code:
// My table setting
table->setSelectionBehavior(QTableWidget::SelectRows);
table->bracketTableWgt->setSelectionMode(QTableWidget::SingleSelection);
table->bracketTableWgt->setEditTriggers(QTableWidget::NoEditTriggers);
// ...
// My row
auto btn = new QPushButton{};
table->setCellWidget(row, column, btn);
// ...
// My connect
connect(table, &QTableWidget::itemSelectionChanged, this, &MyClass::myHandle);
//...
New contributor
chaomi1998 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.