PDA

View Full Version : QTreeWidget::itemDoubleClicked



sabeesh
20th August 2007, 10:29
Hi,
I have a programe in QT. In that program I create a tree using treewidget. I want to read data when i double click on an element of that tree. We can use the event " void QTreeWidget::itemDoubleClicked ( QTreeWidgetItem * item, int column ) " , But how can i read the data from the tree?
Please help me

wysota
20th August 2007, 10:48
It's not an event - it's a signal. Connect a custom slot to it and use "item" to access the data using text(), icon() or data() (depending on what piece of data you want).

rajesh
20th August 2007, 12:30
QTreeWidgetItem *item = currentItem(); will give you current selected item.
you can read item text by
QString itemName = item->text(0);
you can read data like:
QString itemID = item->data(0,Qt::AccessibleDescriptionRole).toString();