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. GraphicsView: Force event propagation to parent item

GraphicsView: Force event propagation to parent item

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

    I use QGraphicsTextItem to display and edit a text. QGraphicsTextItem basically does all the UI interactions itself: Shows a frame when it gets the focus, handles mouse clicks and keyboard events.

    There are times I don't want this. I have tried subclassing QGraphicsTextItem and reimplementing sceneEvent, as well as installing a scene event filter on it. Both approaches work perfectly fine as far as event filtering is concerned.

    However...I want the (now unhandled) events to propagate to the item's parent and further on, so they can be handled there. When installing an event filter, that doesn't happen. When reimplementing sceneEvent and simply returning 'false', it doesn't happen.

    The only thing that seems to work is to reimplement every single event QGraphicsItem offers.

    Is there a way to tell the event filter it should directly forward the events to the item's parents, as if they were unhandled?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Just a shot into the darkness, as I don't have experience with event filters: have you tried a simple QEvent::setAccepted(false) in your event handler? In normal operation (without filters) this causes the even to be propagated.

      (Z(:^

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

        Good point. I'll try. Thanks!

        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