Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, June 2007
Selecting multiple rows in a QTableWidget


Message 1 in thread

I'm extending the class QTableWidget and want to be able to select (IE 
highlight) multiple rows in a QTableWidget programatically, without user 
input.  I have tried using the function selectRow(), but this will cause 
other rows to be unselected.  This leaves only the row previously called 
with selectRow() selected, regardless of the selectionMode of the table. 
    Does anybody have any ideas?  Any help is greatly appreciated,
-Chris Portka

--
 [ signature omitted ] 

Message 2 in thread

On 6/20/07, Chris Portka <cportka@xxxxxxxxxxxxxxx> wrote:
>
> I'm extending the class QTableWidget and want to be able to select (IE
> highlight) multiple rows in a QTableWidget programatically, without user
> input.  I have tried using the function selectRow(), but this will cause
> other rows to be unselected.  This leaves only the row previously called
> with selectRow() selected, regardless of the selectionMode of the table.
>     Does anybody have any ideas?  Any help is greatly appreciated,
> -Chris Portka


I'm not too familiar with QTableWidget, but it seems like you should be able
to use QAbstractItemView::selectionModel() to get a QItemSelectionModel*,
and then you can use QItemSelectionModel::select(...)

Tom