Results 1 to 2 of 2

Thread: Qtreewidget

  1. #1
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Qtreewidget

    i have a qdialog. And i want to open this dialog when clicked on treewidget or focus on treewidget.. not clicked on treewidgetitem...

    how can i do it?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qtreewidget

    install event filter on a treewidget's viewport and process needed events.
    Qt Code:
    1. ...
    2. m_treeWidget->viewport()->installEnvetFilter(this);
    3. ...
    4. bool MyWidget::eventFilter(QObject *o, QEvent *e)
    5. {
    6. if (m_treeWidget->viewport() == o) {
    7. if (e->type() == QEvent::MouseButtonPress) {
    8. const QMouseEvent *me = static_cast<QMouseEvent>(e);
    9. //add whatever you want
    10. } else if (e->type() == QEvent::FocusIn) {
    11. //add whatever you want
    12. }
    13. }
    14. return QWidget::eventFilter(o, e);
    15. }
    To copy to clipboard, switch view to plain text mode 
    PS. please, ask questions like this in Newbie forum.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Filling QTreeWidget / Using QTreeView
    By stefanborries in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2009, 15:25
  2. how to sync a QTreeWidget and a QListWidget?
    By zl2k in forum Qt Programming
    Replies: 2
    Last Post: 5th September 2008, 20:55
  3. QTreeWidget click
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 24th October 2007, 16:47
  4. Having trouble clearing a QTreeWidget.
    By Nyphel in forum Qt Programming
    Replies: 28
    Last Post: 10th October 2007, 15:33
  5. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 22:32

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.