Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3670

sceneEventFilter not only for items but for the whole scene

    XMLWordPrintable

Details

    Description

      I wanted to figure out how similar a QGraphicsScene with items is compared to a regular QApplication with widgets. Reason: A lot effort is going on on qt-labs that uses QGraphicsView for all kinds of fancy stuff.

      Currently you can filter all events that go through a QApplication using QApplication::installEvent filter. You only need one event filter object to filter all events.

      Similar, you can install event filters to QGraphicsItems.

      However you cannot install an event filter to the QGraphicsScene to get the events of all children items. There is also no way to get notified when new children are added to the QGraphicsScene or to its children.

      I think it is important to be feature equivalent with widgets here if stuff like QtKinetics should ever be successful because you cannot trade animations against other features.

      So my suggestion is:

      • Either add some kind of "installSceneEventFilter" to QGraphicsScene or pass all events regarding QGraphicsItems through the ::event-handler of the GraphicsScene if this is not already the case. If it is, document it.
      • Add child added/child remove events to the GraphicsSceneEvents so both the scene and the item can get notified if something in the tree-hierarchy changes.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            monsen Marius Bugge Monsen
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes