keyevent qml overriding

  • hello,

    i want to override the functionality of keyevents when a key is pressed.

    i am using both custom touch keypad and physical keyboard for text entering in a TextField item.
    my code:

                Keys.onPressed: {
                    if (event.key === Qt.Key_A) KbrdCntrl.charPressed("A");

    when i press key "A" using physical keyboard "AA" is displayed in TextField.
    one "A" from physical keyboard and another form the signal i am emitting "kbrdCntrl.charPressed("A")" .
    i want to disable the Physical keyboard's "A" . so that only one "A" will be displayed in TextField when i press "A" on physical keyboard.


  • Moderators

    @AYYAPPA hi, you'll have to accept the keyevent or other wise it wil be passed on

    event.accepted = true;

  • @J-Hilk brilliant !! thanks :)

  • @AYYAPPA if you issue is solved, please don't forget to mark your post as such. Thanks.

  • Hi,
    i have the same problem, but with tab and arrows keys. When i press tab for example, focus changes to next item. I need to override it, but i cannot find how. Letters, numbers, etc are beeing overriden fine, just navigations keys don't work.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.