Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to select multiple combo boxes in a QTableWidget
What can I do to maintain a user's row selection in a QTableWidget when they are selecting combo box items?
It's probably best to show in images:
This is the selection I want:
This is what happens when I select a combo box in the table. The selection is lost and only the row that the combo box is in is selected:
But if I select a combo box outside of the table, the selection is not lost:
How do I keep the selection while clicking a combo box inside the table? I want to be able to select multiple rows and change all the combo boxes in that selection to the same thing all at once. Any help is much appreciated.
capture the key-press and -release events in the combobox so they do not get propagated to the parent (the list view widget) and update the selection.
This can be done by calling accept() on the event in the event handler.
Do you use an item delegate to create the comboboxes?
Thanks raven. I'm using QTableWidget::setCellWidget.
Calling accept() on the events actually didn't work for me. Instead, I ended up overriding selectionCommand and returning QItemSelectionModel::NoUpdate if the column is the same column that my combo boxes are in.