开发者

QTableView - what signal is sent when user selects a row by clicking to it?

开发者 https://www.devze.com 2022-12-16 14:16 出处:网络
Is there a signal which is emitted whenthe user selects a row in QTableView by mouse (开发者_如何学Csingle selection model)?Each view has a Selection model :

Is there a signal which is emitted when the user selects a row in QTableView by mouse (开发者_如何学Csingle selection model)?


Each view has a Selection model :

QItemSelectionModel * QAbstractItemView::selectionModel () const

and with the selection model you can retrieve lots of informations, in your case :

QModelIndexList QItemSelectionModel::selectedRows ( int column = 0 ) const

So :

myTableView->selectionModel()->selectedRows();

You can then retrieve this informations through a signal like :

void QItemSelectionModel::selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected )   [signal]

Hope it helps !

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号