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. How to enable mouse tracking for QGraphicsItem?

How to enable mouse tracking for QGraphicsItem?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qgraphicsitem
3 Posts 2 Posters 969 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.
  • Alex SUNPPA Offline
    Alex SUNPPA Offline
    Alex SUNPP
    wrote on last edited by
    #1

    I have multiple QGraphicsItem set in QGraphicsScene. I want mouseMoveEvent (QGraphicsSceneMouseMoveEvent *event) for these objects to trigger without mousePressEvent(). A documentation clearly says that this behavior is realised by setting setMouseTracking(true) for the widget.
    But the problem is that I don't see any QWidget object inside QGraphicsItem and QGraphicsScene. Where should I put setMouseTracking? Any help will be appreciated.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can have something similar using the hovering related methods. See QGraphicsItem setAcceptHoverEvents for more details.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Alex SUNPPA 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You can have something similar using the hovering related methods. See QGraphicsItem setAcceptHoverEvents for more details.

        Alex SUNPPA Offline
        Alex SUNPPA Offline
        Alex SUNPP
        wrote on last edited by
        #3

        @SGaist yes, hovering will be okay too. I just didn't think that constant mouse tracking is such a problem.

        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