View Full Version : How to select a QTableWidget cell containing a QCheckBox

23rd October 2009, 21:36
I have a QTableWidget in which I have set some cells to contain QCheckBox'es. When the dialog is running, if I click in a cell containing a checkbox, it will be selected, and turn blue. How can I make this happen programmatically? I tried using setCurrentCell() but that seems to invoke a different kind of selection, where the item only turns grey, which is indistinguishable on rows that are already grey (I'm using the "alternating row colors" setting).

Any help would be greatly appreciated!


The Storm
23rd October 2009, 23:48
Take a look at QItemSelectionModel. You can get pointer to it from the QTableWidget with the method selectionModel(). Good luck. :)