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. Capture mouse cruising events (buttons not pressed)

Capture mouse cruising events (buttons not pressed)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.7k Views 1 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.
  • N Offline
    N Offline
    novaktamas
    wrote on last edited by
    #1

    I have a

    @ZoomPan_GrView::ZoomPan_GrView(QWidget* parent) : QGraphicsView(parent) { //my subclassed QGraphicsView
    @

    where I can zoom and pan my graphicsview through mouse event handlers:

    @virtual void mousePressEvent(QMouseEvent* event);
    virtual void mouseReleaseEvent(QMouseEvent* event);
    virtual void mouseMoveEvent(QMouseEvent* event);
    virtual void wheelEvent(QWheelEvent* event);
    virtual void resizeEvent(QResizeEvent* event);
    @
    but I want to display the mouse's scene coordinates when mouse simply cruising over the graphicsview.
    All the above events depends on mousebutton press.

    I tried MouseGrabArea and grabMouse() etc. but all I produced were various and impressive crashes:))
    How to grab mouse coordinates when just moving over the graphicsview?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Did you enable mouse tracking on the viewport?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • N Offline
        N Offline
        novaktamas
        wrote on last edited by
        #3

        Thank you, Peppe, this was the problem.
        If I

        QGraphicsView::setMouseTracking(true)

        than got the

        mouseMoveEvent(QMouseEvent* event)

        invoked.

        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