Results 1 to 5 of 5

Thread: overlaping QGraphicsItem-s hover events

  1. #1
    Join Date
    May 2008
    Location
    Rijeka, Croatia
    Posts
    85
    Thanks
    10
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default overlaping QGraphicsItem-s hover events

    I have more QGraphicsItems on top of each other. How can I make hover event available for all items? Only the last added item (the one on the top) accepts hover events.

    Thanks

  2. #2
    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: overlaping QGraphicsItem-s hover events

    You can ignore the event in the item. It will then propagate to the item below.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2008
    Location
    Rijeka, Croatia
    Posts
    85
    Thanks
    10
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: overlaping QGraphicsItem-s hover events

    I done this, but it's not working. Only top item receives hover event.
    Any advice where to look for an error?
    Qt Code:
    1. void MyItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
    2. {
    3. drawRuler = true;
    4. update();
    5. event->ignore();
    6. }
    To copy to clipboard, switch view to plain text mode 

  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: overlaping QGraphicsItem-s hover events

    Probably an item will only receive hoverMoveEvent when it has already accepted hoverEnterEvent. You need to propagate all hover events.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2008
    Location
    Rijeka, Croatia
    Posts
    85
    Thanks
    10
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: overlaping QGraphicsItem-s hover events

    Quote Originally Posted by wysota View Post
    Probably an item will only receive hoverMoveEvent when it has already accepted hoverEnterEvent. You need to propagate all hover events.
    I already did that. No success..
    In documentation it says that ignore has no effect. That's probably the reason why is not working..
    Calling QEvent::ignore() or QEvent::accept() on event has no effect.
    http://doc.qt.nokia.com/4.7-snapshot...overEnterEvent

Similar Threads

  1. How to detect hover events when mouse button is pressed
    By yagabey in forum Qt Programming
    Replies: 12
    Last Post: 26th April 2016, 09:23
  2. QGraphicsItem hover event
    By xgoan in forum Qt Programming
    Replies: 6
    Last Post: 4th January 2016, 15:08
  3. QGraphicsItem's hover event problem
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 29th July 2011, 05:51
  4. QGrsphicsItem click and hover events
    By liqxpil in forum Newbie
    Replies: 3
    Last Post: 21st October 2010, 10:51
  5. QGraphicsItem hover events
    By stefan in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2008, 11:01

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.