Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml TextField inputMethodHints not working on ios
Forum Updated to NodeBB v4.3 + New Features

Qml TextField inputMethodHints not working on ios

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlioskeyboardtextfield
2 Posts 1 Posters 2.6k 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.
  • guidupasG Offline
    guidupasG Offline
    guidupas
    wrote on last edited by
    #1

    I am trying to use a TextField that receives only numbers in QML. I am using the inputMethodHints property to make the device keyboard show just numbers. It works fine in Android but when I run it in iOS it shows the full keyboard, with digits, characters and predictive words.

    Code below:

    TextField {
        id: numeroTelefoneTextField
    
        anchors.verticalCenter: parent.verticalCenter
        anchors.right: parent.right
    
        width: parent.width * 0.70
        height: parent.height * 0.6
    
        placeholderText: qsTr("Seu número")
    
        font.bold: true
    
        validator: RegExpValidator{regExp: /\d+/}
    
        inputMethodHints: Qt.ImhDigitsOnly
    }
    

    I have tried other options to like inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText and just inputMethodHints: Qt.ImhNoPredictiveText but none of this options worked in iOS.

    Att.
    Guilherme Cortada Dupas

    1 Reply Last reply
    0
    • guidupasG Offline
      guidupasG Offline
      guidupas
      wrote on last edited by
      #2

      I solved that just removing the validators, but I don't know why it worked without the validator.

      Code below:

      TextField {
          id: numeroTelefoneTextField
      
          anchors.verticalCenter: parent.verticalCenter
          anchors.right: parent.right
      
          width: parent.width * 0.70
          height: parent.height * 0.6
      
          placeholderText: qsTr("Seu número")
      
          font.bold: true
      
          inputMethodHints: Qt.ImhDigitsOnly
      }
      

      Att.
      Guilherme Cortada Dupas

      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