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. QGraphicsView - track mouse position without press?

QGraphicsView - track mouse position without press?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.8k 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    I have few qGraphicItems in my scene/view. I'd like to enlarge them if mouse is within x distance from the item. So that pressing on them is easier in case they are small.

    Can any1 suggest how I can track the mouse in graphic view & more ?

    I tried getting mouseMoveEvent and then somehow see if there is a "visible items" array in view to loop over to check their position/distance from mouse. But the mouseMoveEvent don't get fired till the mouse button is pressed so that did not work.

    What other events can I use? Do I need to installe some event filter?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by dheerendra
      #2

      you need to enable the mouseTracking with setMouseTracking(true) for graphicsView. Then you can track the mouseMovment without press and move. Use setAcceptHoverEvents(..) on GraphicsItem

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      3

      • Login

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