praveen
praveen

Reputation: 93

How to capture Hide key event in Qt VirtualKeyboard

I am using Qt virtual Keypad in my project.

I am able to print key values (using event.key) in console log for all keys, except hide key event (which is marked as red color in attached image).

Can anyone please help me in capturing the hide key event in virtual keyboard.

Below is the sample code for capturing key events

TextField{
    id:sampletextfield
    width: window.width/1.5
    height: parent.height*.5
    anchors.centerIn: parent
    font.bold: true
    font.pixelSize: parent.height*.2

    Keys.onReleased: {
        console.log("key event = " + event.key)
    }
}

Virtual Keyboard

Upvotes: 3

Views: 1245

Answers (1)

eyllanesc
eyllanesc

Reputation: 243897

If you want to detect when the virtualkeyboard is hidden then you can use Qt.inputMethod:

Connections{
    target: Qt.inputMethod
    function onVisibleChanged(){
        if(Qt.inputMethod.visible){
           console.log("show")
        }
        else{
            console.log("hide")
        }
    }
}

Upvotes: 3

Related Questions