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

Nested popup focus control problem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.1, 6.10.0 Beta2
    • Quick: Controls 2
    • None
    • Windows 11
    • Windows

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      ApplicationWindow {
          id: root
      
          component FocusVisualizationItem: Rectangle {
              required property Item focusItem
      
              x: {
                  const refreshTrigger = refreshTimer.refreshTrigger;
                  return focusItem?.mapToItem(Overlay.overlay, 0, 0).x ?? 0;
              }
              y: {
                  const refreshTrigger = refreshTimer.refreshTrigger;
                  return focusItem?.mapToItem(Overlay.overlay, 0, 0).y ?? 0;
              }
              width: focusItem?.width ?? 0
              height: focusItem?.height ?? 0
              visible: focusItem !== null
              parent: Overlay.overlay
              color: "pink"
              opacity: 0.1
              z: 100000000
      
              Timer {
                  id: refreshTimer
      
                  property bool refreshTrigger: false
      
                  running: true
                  interval: 10
                  repeat: true
                  onTriggered: () => {
                      refreshTrigger = !refreshTrigger;
                  }
              }
          }
      
          width: 640
          height: 480
          visible: true
          onActiveFocusItemChanged: () => {
              console.debug("onActiveFocusItemChanged:", activeFocusItem)
          }
          onActiveFocusControlChanged: () => {
              console.debug("onActiveFocusControlChanged:", activeFocusControl)
          }
      
          RowLayout {
              TextField {}
              Button {
                  objectName: text
                  text: "Open Popup"
                  onClicked: popup.open()
      
                  Popup {
                      id: popup
      
                      y: parent.height
                      modal: true
                      closePolicy: Popup.NoAutoClose
                      contentItem: ColumnLayout {
                          Button {
                              objectName: text
                              text: "Open Nested Popup"
                              onClicked: nestedPopup.open()
      
                              Popup {
                                  id: nestedPopup
      
                                  y: parent.height
                                  modal: true
                                  closePolicy: Popup.NoAutoClose
                                  contentItem: ColumnLayout {
                                      Button {
                                          objectName: text
                                          text: "Close Nested Popup"
                                          onClicked: nestedPopup.close()
                                      }
                                  }
                              }
                          }
                          Button {
                              objectName: text
                              text: "Close Popup"
                              onClicked: popup.close()
                          }
                      }
                  }
              }
          }
          FocusVisualizationItem {
              focusItem: root.activeFocusItem
              color: "yellow"
          }
          FocusVisualizationItem {
              focusItem: root.activeFocusControl
              color: "orange"
          }
      }
      

      Steps to reproduce the problem:

      1. Click "Open Popup" button
      2. Click "Open Nested Popup" button
      3. Click "Close Nested Popup" button
      4. Focus was restored to "Open Popup" button instead of "Open Nested Popup" button (bug)
      5. When you press TAB next, text field below modal popup will be focused control (bug)

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            permotion88 Karol Polak
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes