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. MousePressEvent
Forum Updated to NodeBB v4.3 + New Features

MousePressEvent

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

    How can I store the point of a graphics view by clicking left button of a mouse and when click right button the all stored point will return..
    any helping code..

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nosf
      wrote on last edited by
      #2

      Well have a list of points variable in your scene most likely.

      @QList<QPoint> clicked_points_;@

      and in your QGraphicsScene derive "mousePressEvent":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#mousePressEvent

      in it check the functions argument for button() to see which button is pressed

      If left button append the "button down in screen pos":http://qt-project.org/doc/qt-4.8/qgraphicsscenemouseevent.html#buttonDownScreenPos to clicked_points_

      or if right button display clicked_points_ values and clear list after that if needed

      if you want to "return on right click" have a signal to emit clicked_points_, catch that in a slot and you'd be done.

      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