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

QGraphicsScene focus item is not updated when the scene is not focused

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.0, 5.12.1, 5.12.2
    • Widgets: GraphicsView
    • None
    • Windows

    Description

      It seems that the `d->passiveFocusItem` is not updated by QGraphicsScene::setFocusItem() after the scene goes out of focus.

      As a result, after gaining focus itself, it focused the last item that had focus when the scene had focus, instead of the last item set by setFocusItem() calls - even though the scene emits `focusItemChanged` after these calls.

      This causes problems when trying to have a QGraphicsView and some other widget, showing a common list of items, to have the same item selected.

      Example project attached. Try selecting some item in the graphicsView, then another one in the listWidget, then click somewhere to focus graphicsView again - it will reset the focused item back to the previously selected one.

      Attachments

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

        Activity

          People

            bibr Andreas Aardal Hanssen
            zueuk Peter Sdobnov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes