PDA

View Full Version : Row highlight in Tableview with delegate in first column



drmacro
28th November 2015, 20:14
I have a Qtableview with setSelectionBehavior(QtableView.SelectRows) set.

The tableview has a button delegate in the first column.

When I click in a row of the table (some cell other than first column) the clicked event shows the correct row and column being passed.
When I click the button, it launches the editor with the correct data.

But the row never highlights.

I have a different example that does highlight the clicked row, but it does not have a delegate column.

When a delegate is used, how do I high light the selected row?

(For that matter how do I highlight the first row at startup?)

Regards,
Mac

d_stranz
28th November 2015, 21:44
Have you called QAbstractItemView::setSelectionBehavior() with the argument QAbstractItemView::SelectRows?

QAbstractItemView::setCurrentIndex() will select the row at the "index" argument.