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

QTextEdit (and similar widgets) embedded in QGraphicsScene loses focus after its standard context menu has been used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.2, 5.7.1, 5.9.1
    • Widgets: GraphicsView
    • None
    • Windows 7 SP1 x64 + VS2013, Linux Debian 9 x64

    Description

      When menu disapears QGraphicsScene emits focusItemChange with newFocusItem == 0.

      Focus is cleared in function QGraphicsItemPrivate::setVisibleHelper() in 5.6.2:

       

              if (hasFocus && scene) {
                  // Hiding the focus item or the closest non-panel ancestor of the focus item
                  QGraphicsItem *focusItem = scene->focusItem();
                  bool clear = true;
                  if (isWidget && !focusItem->isPanel()) {
                      do {
                          if (focusItem == q_ptr) {
                              clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true);
                              break;
                          }
                      } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
                  }
                  if (clear)
                      clearFocusHelper(/* giveFocusToParent = */ false, hiddenByPanel);
              }

      If it has been done intentionally, the reason is not clear.

      Attachments

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

        Activity

          People

            bibr Andreas Aardal Hanssen
            ivanov I Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes