[Solved] QTableWidget select rows without vertical header
-
Is it possible to make a QTableWidget that has its vertical header hidden but still lets you select rows (by clicking individual items)? I've tried different combinations of setSelectionMode and setSelectionBehavior and setting the item flags to have the items be selectable but I can't seem to get it to work. It appears that I must have the header column visible and click a header item to select a row. Is this true?
I assume I can make a slot that is called when an item is selected and then select that item's row? Or I can show my vertical header and just set the items' text to empty and use the header to select the rows. Just wondering if there's a "cleaner" way to do this and I'm just missing something.
Thanks.
-
Forget it! I figured it out, so in case it helps anyone... I just needed to turn OFF the ItemIsSelectable flag (its off by default but I was turning it on). Now when I click any cell my row is selected (because I setSelectionBehavior(QAbstractItemView::SelectRows) left selection mode as the default.
I was setting one option too many. Now I have my vertical header hidden and I can still select rows by clicking a single item in the row.