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. Passing on (mouse) events from a QGraphicsItem to other QGraphicsItems that occupy the same pixel
Forum Updated to NodeBB v4.3 + New Features

Passing on (mouse) events from a QGraphicsItem to other QGraphicsItems that occupy the same pixel

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

    Hi,

    When I click on my graphics scene, I want not just the graphics item under the cursor with the highest priority to receive it - I want all items under that position to receive the event.

    I've tried to call event->ignore() in my mouse press event handler in my QGraphicsItem subclass, but that screws up drag & drop. (If this is important, I can elaborate on exactly how it screws it up).

    Do you think event->ignore() is the way to go, or is there another way? It doesn't "feel" right, since I don't actually ignore the event - I just want other items to receive it as well. If there were a method called setContinueEventPropagation or similar, that would seem to better express what I'm trying to do.

    If this is not possible, I can introduce my own methods in my QGraphicsItem subclasses to handle events manually, but that's extra work.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You might be interested by "QGraphicsScene::sendEvent":http://doc.qt.io/qt-5/qgraphicsscene.html#sendEvent

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Apelsinsaft
        wrote on last edited by
        #3

        Thank for the pointer! I'll go have a look.

        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