Results 1 to 2 of 2

Thread: TreeWidget mousePressEvent not being captured

  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default TreeWidget mousePressEvent not being captured

    Friends
    I have a claas TreeWidget which is derived from QTreeWidget I am overriding mousePressEvent() but when I am clicking in the region of TreeWidget the event is not getting captured. Please tell what to do . see the codes below

    class TreeWidgetublic QTreeWidget
    {
    Q_OBJECT
    public:
    TreeWidget();
    ~TreeWidget();
    void mousePressEvent(QMouseEvent *me);
    };

    void TreeWdiget::mousePressEvent(QMouseEvent *me)
    {
    qDebug() << "Testing " << "\n";
    }

    //but this event is not being captured in the mainwindow where I am setting this widget on the mainwindow.
    // then i am clicking on the treewidget. but no response.

    whats wrong pls tell me someone.
    Thanks sujan

  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: TreeWidget mousePressEvent not being captured

    did you set QWidget::setMouseTracking for QTreeWidget in true?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. expand a treeWidget
    By mattia in forum Newbie
    Replies: 6
    Last Post: 6th December 2007, 13:24
  2. How to sort the treeWidget item according to size and date
    By santosh.kumar in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2007, 10:32
  3. How to set the sizehint for treeWidget
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2007, 11:35
  4. By default TreeWidget width setting in DockWidget
    By santosh.kumar in forum Qt Programming
    Replies: 0
    Last Post: 31st May 2007, 05:55
  5. How i will use treeWidget of GUI class in thread class
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2007, 15:31

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.