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::mouseReleaseEvent ensures that I can't select QGraphicsItems anymore
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView::mouseReleaseEvent ensures that I can't select QGraphicsItems anymore

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

    Hey,
    In a nutshell: When I implement the mouseReleaseEvent in my QGraphicsView derived class, this happens:
    When I click on an item (QGraphicsItem that I added to the scene), the mousePressEvent of this item gets triggered. But when I click on another item, the old item (this first item I clicked on) is triggered again and not the new one.
    When I delete the mouseReleaseEvent function in the QGraphicsView derived class (so I do not override it anymore), everything works.
    Why is this and how can I fix this?

    Thanks for answers!

    1 Reply Last reply
    0
    • NiagarerN Offline
      NiagarerN Offline
      Niagarer
      wrote on last edited by Niagarer
      #2

      ANSWER
      Never forget to call

      QGraphicsView::mousePressEvent(event); /
      QGraphicsView::mouseReleaseEvent(event); /
      QGraphicsView::mouseMoveEvent(event);
      ...
      

      at the end of every mouseEvent you overrode in your QGraphicsView derived class (in the mouseMoveEvent use QGraphicsView::mouseMoveEvent(event) and so on).
      Otherwise really strange things can happen.
      Also if you even did not use some of these in your QGraphicsItem derived class, call it in every event.

      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