PDA

View Full Version : How to find which column clicked from a treeview.



mekos
4th August 2008, 16:10
Hello

I have created a QStandardItemModel with * rows and 6 columns in each row to pass on a treeview.
I need to use the slot below to do various things ,but ONLY if the second column has clicked in the treeview.If it is any other column just nothing happens, or at least the program enters doThings() function but does a check inside to see what column from the 6 had clicked.If it is the 2nd continues, else breaks.Can someone help me with this check?

(this is the slot:doThings( const QModelIndex& ))

Thanks!

spirit
4th August 2008, 16:26
try to catch


QHeaderView::sectionClicked ( int logicalIndex )

but this signal emits only when header section was clicked.

if you need to determinate column by clicking on item, you can catch


void QAbstractItemView::clicked ( const QModelIndex & index )


and
index.column()

mekos
4th August 2008, 16:44
correct..thanks man!