PDA

View Full Version : QTableView row selection



davemar
5th December 2007, 15:10
I've got a QTableView displaying a table of 3 columns and any number of rows. When the user clicks on a row or an item in the row it selects (via a connect) an item in a graphics scene. However I would also like to able to highlight a row when the user clicks on an item in the scene. I can't see anyway of highlighting a row in code, only via a mouse click.

Is it also possible to prevent columns and the whole table from being highlighted when a user clicks of those parts of the table?

BrainB0ne
5th December 2007, 15:18
i'm not a Qt4 user, but Qt3.... but if i check the Qt4 Assistent. i see this function:



void QTableView::selectRow ( int row ) [slot]

Selects the given row in the table view if the current SelectionMode and SelectionBehavior allows rows to be selected.
See also selectColumn().

Maybe this is what you are searching?

davemar
5th December 2007, 15:39
I tried that one as it was the obvious one I found, but unfortunately it doesn't highlight the row.