Results 1 to 4 of 4

Thread: Ignore mouse events out of tree view

  1. #1
    Join Date
    Dec 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Ignore mouse events out of tree view

    Hi, my application which is a treeview should have a facility of ignoring events outside the tree view.
    The mouse click event including right click/single and double click has to be recognised only if that happens on the tree view.

    can any one please suggest what to do?

    thanks in advance,

    regards,
    vamsi.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Ignore mouse events out of tree view

    What things do u have other than the tree view ??
    take actions only if mouse was clicked in the tree view.. dont take any action otherwise.

    For checking if the mouse was clicked in the tree view, map the cordinates to view and check if it lies within the boundary / geometry of the view.
    hope this helps

  3. #3
    Join Date
    Dec 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Ignore mouse events out of tree view

    thank you, presently there is only tree view.
    but how to track the tree view, since the view can expand depending on data.

    i got what you are saying ...may be a small snippet of code will help alot.

    thanks,
    krishna.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ignore mouse events out of tree view

    But what do you want to do in the first place? Events are ignored by default, so you don't have to do anything to ignore them - just don't handle them... Right clicking is enabled by default only on textual widgets (like QTextEdit), for others you don't have to care.

    In general, if you want to filter the events, you can subclass QApplication and reimplement notify() or install an event filter on the application instance object - you can reach all events from the whole application there and stop the ones you don't want propagated.

Similar Threads

  1. traversing tree using mouse clicks
    By krishna.bv in forum Qt Programming
    Replies: 3
    Last Post: 22nd December 2006, 09:15
  2. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  3. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 06:13
  4. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25
  5. Forwarding mouse events to another widget.
    By yogeshm02 in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 13:25

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.