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 973 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.
  • A Offline
    A Offline
    Alex SUNPP
    wrote on 16 Sept 2020, 12:17 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Sept 2020, 18:06 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

      A 1 Reply Last reply 21 Sept 2020, 07:33
      0
      • S SGaist
        16 Sept 2020, 18:06

        Hi,

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

        A Offline
        A Offline
        Alex SUNPP
        wrote on 21 Sept 2020, 07:33 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

        2/3

        16 Sept 2020, 18:06

        • Login

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