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

Keys.onPressed stops working when i focus else but then back to original item

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0 RC2
    • None
    • windows 10
    • Android

    Description

      im facing something which I cant explain... I have this code:

       

      import QtQuick 2.12
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
      
          id: mainWindow
          visible: true
          width: 480 height: 800
          title: qsTr("application")
          
          Item {
              id: keyboardHandler
              focus: true
              onFocusChanged: console.log(keyboardHandler.focus);
      
              Keys.onPressed: { console.log(event.text; }
          }
           
          Image {
              id: focusToKeyboardHandler
              anchors.fill: parent
              MouseArea {
                  anchors.fill: parent
                  onClicked: { keyboardHandler.focus = true; }
              }
          }
              
          TextField {
              id: textfieldID
          }
      }
      

       

      and when I start the application, then all keyboard strokes properly prints into console as they should... however if i click into the TextField, then back to image, then the keystrokes dont print anything at all Why? when I click on the Image, the it properly givers me focus to keyboardHandler (proved by onFocusChanged always debugs true before i start typing... so focus on keyboardHandler is always there when needed)...

      UPDATE: it works on physical typing onto keyboard keys... however using the barcode scanner (tried several devices different vendor, model, types) which is HID it works only first time i start the application, not when i change focus and then back to keyboardHandler

      UPDATE2: when turning application off and on works again only for the first time (or till i rechange the focus)

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            shokarta Jiri Zaloudek
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes