QGraphicsItems, QGraphicsProxyWidgets and HoverEvents



  • Hello,

    I have coded my application so that, if I hover on my QGraphicsItems long enough (200 ms), QGraphicsProxyWidgets (which are QToolButtons) appear on them. I've also coded my application so that, if I stop hovering on my QGraphicsItems, all QGraphicsProxyWidgets/QToolButtons instantly disappear.

    And this is a problem because, if I decide to click on one of those QGraphicsProxyWidgets/QToolButtons, I stop hovering on the QGraphicsItem beneath it first, and all QGraphicsProxyWidgets/QToolButtons disappear right away as a result.

    Is there a way to fix that? I would like to make my QGraphicsProxyWidgets/QToolButtons transparent hovering-wise, I mean: they are visible, but if I hover on them, they are not considered to be hovered on and instead, the first QGraphicsItem under them is. That would solve my problem but I don't know if that's possible.

    Any help would be greatly appreciated. Thanks.


  • Lifetime Qt Champion

    Hi,

    You can try with an event filter. See QObject::installEventFilter for more information



  • Hello @SGaist , I'm sorry but I'm not sure I understand what I should try. How can filters solve this problem?

    Edit: I've managed it by subclassing QGraphicsScene. Thanks.


  • Lifetime Qt Champion

    You're welcome !

    Since you have a working now, please mark the thread as solved using the "Topic Tool" button so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.