Results 1 to 3 of 3

Thread: Extract Item from the QTreeView

  1. #1
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Extract Item from the QTreeView

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Extract Item from the QTreeView

    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.

  3. #3
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Extract Item from the QTreeView

    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

Similar Threads

  1. QTreeView item color
    By tmmak in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2011, 06:08
  2. Buttons on item in QTreeView?
    By joeld42 in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2010, 01:27
  3. QTreeView::item stylesheet
    By Baasie in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2009, 14:55
  4. QTreeView and item editing
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 18:56
  5. extract item from QListWidget
    By impeteperry in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2006, 19:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.