2012年12月19日 星期三

[cpp][qt4] QTableView signals clicking & index variable passing

[cpp][qt4] QTableView signals clicking & index variable passing



1
2
3
4
5
6
7
8
9
10
connect(tableView, SIGNAL( clicked( const QModelIndex & )), this, SLOT( receviedIndex( const QModelIndex & ) ));

void mainwindow::receviedIndex( const QModelIndex &index )
{
   // QModelIndex index already references the data as a QVariant 
   qDebug() << index.data();
   qDebug() << "index col: " << index.column();
   qDebug() << "index row: " << index.row();

}

Ref : 
http://www.qtforum.org/article/33855/index-value-from-qtableview-by-clicking.html

沒有留言:

張貼留言