Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Are hover events propagated tree-wise in a QGraphicsScene?

Are hover events propagated tree-wise in a QGraphicsScene?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 921 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rivimey
    wrote on last edited by
    #1

    I have set up a Qt 4.8 QGraphicsScene with a lot of items, and grouped those items into layers using a QGraphicsItemGroup per "layer" : that is, per set of related items. Items are added to groups, then the groups to the scene.

    I want to enable hover actions for some items so in one item type (that I had already subclassed) I inherited the hover event functions, and in the constructor of those items enabled hover events.

    Nothing happened. I found that the code that enables hover events on the scene itself only checks for the item being added wanting hover events, rather than the recursive check of its children you might expect.

    So I enabled hover events on the groups - without implementing the event functions as there was no functionality needed - and while hover events now get called, the event handlers for the items I want aren't.

    The construct I have is a space-wise tree - with large items overlaid by smaller ones. For example, large square image tiles overlaid by much smaller line and polyline objects. The group (layer) objects are normally all of a similar size (== the whole scene) - their actual size will depend on the distribution of items, but variation will be minor.

    It seems to me that what I am seeing is that the code passing out hover events sees there are a number of items at a particular X,Y coord and picks the first one in the returned list - which may be but normally isn't an "interesting one". It seems to ignore the rest but pays a lot of attention optimising the one it picked...

    I had expected that all the possible event handlers for a particular X,Y would be called...

    Is my analysis correct and is there a solution?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved