Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT 5.9.4 - virtualkeyboard problems
Qt 6.11 is out! See what's new in the release blog

QT 5.9.4 - virtualkeyboard problems

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 493 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Forcecode
    wrote on last edited by Forcecode
    #1

    Hi,

    I am struggling with qtvirtualkeyboard on embedded linux device with qt 5.9.4

    I created a start.qml file which looks as follows:

    import QtQuick 2.9
    import QtQuick.Window 2.3
    import QtQuick.Controls 2.2
    import QtQuick.VirtualKeyboard 2.1
    
    ApplicationWindow {
        width: 800
        height: 1280
        flags: Qt.FramelessWindowHint
        visible: true
    
        Item {
            id: root
            width: 800
            height: 1280
            visible: true
    
            Item {
                id: appContainer
                anchors.left: parent.left
                anchors.top: parent.top
                anchors.right: parent.right
                anchors.bottom: inputPanel.top
    
                TextField {
                    x: 10
                    y: 10
                    color: "#192e4c"
                    maximumLength: 8
                    inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhHiddenText
                    focus: true
                    onActiveFocusChanged: {
                        if (activeFocus) {
                            Qt.inputMethod.update(Qt.ImQueryInput)
                        }
                    }
                }
    
            }
    
            InputPanel {
                id: inputPanel
                y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height
                anchors.left: parent.left
                anchors.right: parent.right
            }
        }
    
    }
    

    and this works as expected - there is a keyboard with digits only and I can enter digits to the TextField.

    If I modify my qml as follows and try to use my TextField in stacked qml there is a full keyboard showing on the screen and each key press generates an "input method is not set" message on the terminal. Digits are not entered into TextField.

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    import QtQuick.VirtualKeyboard 2.1
    
    ApplicationWindow {
        width: 800
        height: 1280
        flags: Qt.FramelessWindowHint
        visible: true
    
        Item {
            id: root
            width: 800
            height: 1280
            visible: true
    
            Item {
                id: appContainer
                anchors.left: parent.left
                anchors.top: parent.top
                anchors.right: parent.right
                anchors.bottom: inputPanel.top
    
                StackView {
                    id: stack
                    anchors.left: parent.left
                    anchors.top: parent.top
                    anchors.right: parent.right
                    anchors.bottom: parent.bottom
    
                    initialItem: "qrc:/test.qml"
                }
            }
    
            InputPanel {
                id: inputPanel
                y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height
                anchors.left: parent.left
                anchors.right: parent.right
            }
        }
    
    }
    

    This is the content of test.qml pushed on stack

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    
    Item {
        width: 800
        height: 1280
    
        TextField {
            x: 10
            y: 10
            color: "#192e4c"
            maximumLength: 8
            inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhHiddenText
            focus: true
            onActiveFocusChanged: {
                if (activeFocus) {
                    Qt.inputMethod.update(Qt.ImQueryInput)
                }
            }
        }
    
    }
    

    Regards,

    Michal

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved