PDA

View Full Version : Extract Item from the QTreeView



sajis997
23rd March 2011, 22:38
Hello Forum,

I have subclassed the QAbstractItemModel and assign it to the sub-class of the QTreeView.

The subclass of the QTreeView is again encapsulated inside a custom widget.

Now when the user click over any item of the QTreeView object i need to extract a particular item and extract more data from it.

I looked at the clciked() and pressed() signal inside the QAbstractItemView and i cannot find the difference between them. I want to get it functional only with the left mouse click event.


Any suggestion would be of great help.

Regards
Sajjad

ChrisW67
23rd March 2011, 23:01
Look at the tree view's selection model. It issues QItemSelectionModel::currentChanged() signals when the current item changes, which it will do if you click on an item. Alternatively, you could look at the protected QAbstractItemView::currentChanged() method in the tree view class.

sajis997
25th March 2011, 08:40
Thanks

I looked into the signal connection as follows:

/////////////////////////////////
connect(m_h3dNodeTreeView,SIGNAL(pressed(QModelInd ex)),this,SLOT(getH3DTreeItemData(QModelIndex)));
////////////////////////////////


In the slot i just try to print out if any of the QTreeViewItem is pressed.


But i do not get any output in the slot.

Any other hint?


Regards
Sajjad