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

Qt 6.10 QML WebView denying focus to other elements even when invisible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.10.0
    • WebView
    • None
    • Android, Windows

      Hey QT Team,

      I'm trying to display a dialog with a textfield over a Webview in QML. As the WebView is always in the foreground, I changed it to be invisible as long as the Dialog (or some other overlay) is opened.

      This seems to be working fine using Qt 6.7.3. As soon as the dialog pops up the Webview becomes invisible and im able to enter a password into the textfield.
      However I'm running into issue when using Qt 6.10.0. Initially it works the same, but after I've clicked into the WebView im still able to open the dialog (the WebView is also being turned invisible), but I'm unable to enter anything into the textfield. The Textfield is not being focused and it seems to loose the focus as soon as I click the Textfield. This happens on Windows as well as Android.
      Also WebView.visible does not seem to work properly as it only renders the WebView invisible if I change the size or position.

      Heres the qml code for my components:

      WebView {
          id: webview
          anchors {
              top: parent.top
              right: parent.right
              bottom: infoText.top
              left: parent.left
              topMargin: webview.visible ? 0 : 1 // For some reason this causes QML to properly evaluate visible
          }
      
          visible: !header.drawer.visible && !root.exitDialog.opened && !root.logoffDialog.opened && !root.wrongPasswordDialog.opened
      
          Rectangle {
              id: progressBar
              anchors {
                  left: parent.left
                  bottom: parent.bottom
              }
              height: 5
              width: parent.width * (webview.loadProgress / 100)
              visible: webview.loading
              color: Material.accent
          }
      } 
      Dialog {
          id: exitDialog
          property bool exitAccepted: false
      
          Column {
              spacing: 16
              Label {
                  //= LYDIA_SCREEN_BUTTON_FINISH
                  text: qsTranslate("LydiaSystemScreenMessages", "Exit") + "?"
              }
              TextField {
                  id: exitPasswordField
                  placeholderText: "Password"
                  visible: TUiContext.quitPassword !== ""
                  echoMode: TextField.Password
                  onAccepted: exitDialog.accept()
              }
          }
      
          standardButtons: Dialog.Yes | Dialog.No
          anchors.centerIn: Overlay.overlay
      
          onAccepted: {
              if (exitPasswordField.text === TUiContext.quitPassword) {
                  exitAccepted = true;
                  TUiContext.quitApp(true);
              } else
                  wrongPasswordDialog.open()
          }
      
          onClosed: {
              exitTimer.stop()
              exitPasswordField.text = ""
          }
      
          onAboutToShow: {
              if (TUiContext.quitPassword === "")
                  exitTimer.start()
          }
          Timer {
              id: exitTimer
              interval: 10000
              repeat: false
              onTriggered: exitDialog.close()
          }
      } 

      Bear in mind that these are just some snippets and not the complete qml files. But the sources are almost identical to the sources using Qt 6.7.3.

      I've attached a video detailing the issue.

      Kind regards,
      Jan Klemens

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

            stromme Christian
            janklemens Jan Klemens
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes