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. Mouse event propagation in QGraphicsScene
Forum Updated to NodeBB v4.3 + New Features

Mouse event propagation in QGraphicsScene

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 448 Views 2 Watching
  • 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.
  • F Offline
    F Offline
    Foufy
    wrote on last edited by
    #1

    Hi everybody,
    what my situation :
    I have two QGraphicsRectItem placed inside a QGraphicsScene. I've set the acceptHoverEvents flag to true. Then I'm able to manage the hoverEnterEvent or hoverLeaveEvent for the two QGaphicsRectItem when I passed the mouse cursor over the rectangles. OK, perfect, I'm pround of me.

    But I need to have such events even if the left mouse button is clicked. And with the mouse button pressed the hover events are not generated.
    My question is how to have hoverEnterEvent for QGraphicsRectItem in any case, and especially when the mouse button is pressed.
    Thank you.

    Foufy

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      Where is the left button clicked before you move the mouse? Inside or outside the scene?

      In some cases, when you left click and hold while on an item or widget, that item or widget will grab the mouse, so it can track mouse moves even as they leave that respective item.

      In general, mouse events are first delivered to the QGraphicsView (on QWidget level), then forwareded to the QGraphicsScene, then translated into QGraphics*-Event types, and then delivered to the correct items. So you could try catching the events on Scene or View level. You could also look for MouseMove events instead of Hover

      1 Reply Last reply
      1

      • Login

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