Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › AppTextField inputMethodHints does not work on desktop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18998

    Javier

    This example shows some AppTextFields with inputMethodHints. It works fine on iOS, it restricts keys and shows the appropriate keyboards. However, it does not work on desktop (at least on Linux). Is this supposed to work only on mobile devices? Below, there is a link to the web editor and the code.

    https://felgo.com/web-editor/?snippet=503d97d1

    import QtQuick 2.10
    import Felgo 3.0
    import QtQuick.Controls 1.3
    
    App{
        NavigationStack{
            Page{
                title: "Input method hints"
    
                Column {
                    anchors.fill: parent
                    spacing: dp(20)
    
                    Item{
                        width: 1
                        height: dp(10)
                    }
    
                    AppTextField{
                        anchors.horizontalCenter: parent.horizontalCenter
                        borderColor: "black"
                        borderWidth: 2
                        width: parent.width - dp(20)
                        inputMethodHints: Qt.ImhDigitsOnly
                        placeholderText: qsTr("Only digits")
                    }
    
                    AppTextField{
                        anchors.horizontalCenter: parent.horizontalCenter
                        borderColor: "black"
                        borderWidth: 2
                        width: parent.width - dp(20)
                        validator: RegExpValidator { regExp: /^[0-9\+\-\#\*\ ]{6,}$/ }
                        inputMethodHints: Qt.ImhDialableCharactersOnly
                        placeholderText: qsTr("Only dialable characters")
                    }
    
                    AppTextField{
                        anchors.horizontalCenter: parent.horizontalCenter
                        borderColor: "black"
                        borderWidth: 2
                        width: parent.width - dp(20)
                        inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
                        placeholderText: qsTr("Only email characters")
                    }
    
                    AppTextField{
                        anchors.horizontalCenter: parent.horizontalCenter
                        borderColor: "black"
                        borderWidth: 2
                        width: parent.width - dp(20)
                        inputMethodHints: Qt.ImhUrlCharactersOnly
                        placeholderText: qsTr("Only URL characters")
                    }
                }
            }
        }
    }
    

     

    #19034

    Günther
    Felgo Team

    Hi,

    the inputMethodHints feature of AppTextField is based on the TextField QML Type by Qt. The settings may have different effect on different platforms. Also, as a Desktop keyboard usually covers all available keys, the input hints are more focused on e.g. mobile devices, where the amount of shown keys is more limited and the usage of a subset of keys or different keyboard makes sense.

    Best,
    Günther

     

    #19049

    Javier

    Hi Günther,

    I thought inputMethodHints applied some kind of validation over the input text, but it does not seem to be the case, so I think I have to define some kind of validation or regular expression in the validator property.

    #19057

    Günther
    Felgo Team

    Correct, input validation is not covered by the input method hints.
    They only suggest which kind of user input you expect, to e.g. show a different keyboard on mobiles.

     

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded