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. Both the QGraphicsView and QGraphicsItem response to the mousePressEvent?

Both the QGraphicsView and QGraphicsItem response to the mousePressEvent?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.4k 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.
  • O Offline
    O Offline
    opengpu
    wrote on last edited by
    #1

    i overrider mousePressEvent for both QGraphicsView and QGraphicsItem to get mouse right button down event...but both of them get the event...and I just want the QGraphicsItem get the event...how to prevent it from the QGraphicsView?
    ps. and I tried contextMenuEvent of the QGraphicsItem, it woks the same.
    thank you

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vikaspachdha
      wrote on last edited by
      #2

      When you reimplement the event handlers, the event is by default accepted and it does not propagates further. If you are reimplementing mousePress, also reimplement mouseRelease. Post your code if you still face the problem.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu
        wrote on last edited by
        #3

        i just override the 2 mousePress func in the 2 classes...and at last in the func, call the mousePress of QGraphicsView and QGraphicsItem

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vikaspachdha
          wrote on last edited by
          #4

          LIke I said, did you reimplemented the mouse release also? Do that and reply with the results.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ashokb
            wrote on last edited by
            #5

            Post some code here, so that we can get some idea of whats going wrong...
            You may like to read this
            http://blog.qt.digia.com/blog/2006/05/27/mouse-event-propagation/

            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