Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTVirtualKeyboard plugin - disabled keys are enabled if layout was switched
Qt 6.11 is out! See what's new in the release blog

QTVirtualKeyboard plugin - disabled keys are enabled if layout was switched

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 309 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    AndreFiedler
    wrote on last edited by
    #1

    Hi,

    I have a strange behaviour of the qtvirtualkeyboard plugin. You can see it in this video:
    https://photos.google.com/share/AF1QipN1DZ7nxCBw0SsPms0fbwigPp5PFC0WjrWV6_ZaSiU4gLdKXfSZsgX2K2APsVyzSQ/photo/AF1QipOOd816PxVThdp6eP-kQjPEIzmsFmeRaSmEor0?key=N3p5dTNYbUJkd2FPbm9MM3EyQnJxNXZqeEFYMFZ3

    If the user switches between "&123" and "ABC" layout, everything is fine - all disabled keys are still disabled. But if the user switches between "1/2" and "2/2" layout, they are enabled again. But if you then switch again between "&123" and "ABC" they are disabled again. Thats strange.

    What can be wrong? Or how can I fix this?

    This is my code to disable the keys (by now I have no code to enable them again, so they must be disabled still):

    
        property var keyboardLayout: inputPanel.keyboard.layout
        property var specialKeysDiabled: false
    
        function disableSpecialKeys(parent) {
            specialKeysDiabled = true
            var obj = null
            if (typeof parent == "undefined" || !parent)
            {
                parent = inputPanel.keyboard
            }
            var children = parent.children
            for (var i = 0; i < children.length; i++) {
                obj = children[i]
                if (
                    /[^a-zA-Z0-9\(\)_\s]/.test(obj.text) && 
                    obj.toString().substring(0, 7) === "BaseKey"
                ) {
                    obj.enabled = false
                }
                if (obj === null) {
                    break
                }
                obj = disableSpecialKeys(obj)
                if (obj)
                {
                    break
                } 
            }
            return obj
        }
    
        onKeyboardLayoutChanged: {
            if (keyboardLayout !== "") {
                if (specialKeysDiabled) {
                    disableSpecialKeys()
                }
            }
        }
    
    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