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

Connecting to the onVisibleChanged signal of Qt.inputMethod and forcing active focus causes freeze

XMLWordPrintable

    • Android, iOS/tvOS/watchOS

      I have an application with a StackView. One page is a list and has a filter inputbox. The page listens for Stack.status and when it gets Inactive, the inputMethod is hidden.
      This does not return focus to the the StackView, however, which handles the back button (the app will exit now when tapping the back button instead of popping the StackView). To prevent this, I wanted to listen for the onVisibleChanged and if the inputMethod is not visible, forceActiveFocus() on the StackView.

      StackView {
        id: pageView
        anchors.fill: parent
        focus: true
        
        Connections {
          target: Qt.inputMethod
          onVisibleChanged: {
            if (!Qt.inputMethod.visible) {
              pageView.forceActiveFocus()
            }
          }
        }
      
        Keys.onReleased: {
          if (event.key === Qt.Key_Left && (event.modifiers & Qt.AltModifier)) {
            if (pageView.depth > 1) {
              pageView.pop()
              event.accepted = true
            } else {
              event.accepted = false // fallthrough and Qt closes the app
            }
          }
        }
      }
      

      As soon as I tap the input box on the page, the application freezes, both on a Nexus 5 (Android 4.4) and iPod touch (iOS 6.1) with a debug message

      W/IInputConnectionWrapper( 7977): getCursorCapsMode on inactive InputConnection

      , the keyboard appears two seconds later and another 5 seconds later the app is terminated with SIGABRT.

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

            lukasz.kosiorowski lukasz.kosiorowski
            broulik Kai Uwe Broulik
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes