How to get both index and selected item at asame time in qtreewidget?
aurora last edited by
Hi i have a problem...In my tree widget i wanted to know the selected (actually checked) item index
for that i used signal
Now i wanted along with index i needed current item too, for that one more signal i got
but i wanted a signal to get index and current item at a same time....how can i do that?
please help me...i tried in manual but didnt understand how can i get both index and current item at same time...
koahnig last edited by
You could use a two staged approach, if you really need to have both at the same time.
Receive the model index through first connection of signal clicked to your slot. Subsequently, you can "retrieve a pointer to your item":http://developer.qt.nokia.com/doc/qt-4.8/qtreewidget.html#currentItem and send the signal with both as you require.
However, the question is, if you still require to have both sent in a signal.
broadpeak last edited by
this is a two step problem, i think:
this will return in your case a QList with one item
QTreeWidget::indexFromItem ( QTreeWidgetItem * item, int column = 0 ) will get the index for you