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. onTextChanged signal on Android
Forum Updated to NodeBB v4.3 + New Features

onTextChanged signal on Android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 3 Posters 1.4k 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.
  • F Offline
    F Offline
    Francky033
    wrote on last edited by Francky033
    #1

    Hello,

    I have a little problem with a qml box under Android (Qt 5.15.0)
    When I type text in this TextInput (see below), a TextChanged signal is only emitted when I press ENTER on the Android virtual keyboard. I would like the signal to be sent for each new letter I type. This would allow me to make suggestions during text input.

    How can I do this?

    Under Windows and Linux, everything works well this way

    Thanks !

    TextInput {
                     id: textInput
                     y: 25
    
                     height: 30
                     color: "#ffffff"
                     text: anchorselection.search
                     anchors.right: busyIndicator.left
                     anchors.rightMargin: 10
                     anchors.left: image3.right
                     anchors.leftMargin: 10
                     anchors.bottom: parent.bottom
                     anchors.bottomMargin: 0
                     activeFocusOnPress: anchorselection.Android
                     focus: !anchorselection.Android
                     cursorVisible: true
                     font.family: "Tahoma"
                     font.pixelSize: 20
    
                     Rectangle {
                         color: "#1e252f"
                         anchors.fill: parent
                         z: -1
                     }
    
                     inputMethodHints: Qt.ImhNoPredictiveText
    
                     onTextChanged: {
                         if (anchorselection.search !== textInput.text)
                             anchorselection.checkPost_Search(textInput.text)
    
                     }
                 }
    
    ekkescornerE 1 Reply Last reply
    0
    • Quang PhuQ Offline
      Quang PhuQ Offline
      Quang Phu
      wrote on last edited by
      #2

      @Francky033
      Have you tried onTextEdited ?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Francky033
        wrote on last edited by
        #3

        Si. Yes, it gives the same result...

        1 Reply Last reply
        0
        • F Francky033

          Hello,

          I have a little problem with a qml box under Android (Qt 5.15.0)
          When I type text in this TextInput (see below), a TextChanged signal is only emitted when I press ENTER on the Android virtual keyboard. I would like the signal to be sent for each new letter I type. This would allow me to make suggestions during text input.

          How can I do this?

          Under Windows and Linux, everything works well this way

          Thanks !

          TextInput {
                           id: textInput
                           y: 25
          
                           height: 30
                           color: "#ffffff"
                           text: anchorselection.search
                           anchors.right: busyIndicator.left
                           anchors.rightMargin: 10
                           anchors.left: image3.right
                           anchors.leftMargin: 10
                           anchors.bottom: parent.bottom
                           anchors.bottomMargin: 0
                           activeFocusOnPress: anchorselection.Android
                           focus: !anchorselection.Android
                           cursorVisible: true
                           font.family: "Tahoma"
                           font.pixelSize: 20
          
                           Rectangle {
                               color: "#1e252f"
                               anchors.fill: parent
                               z: -1
                           }
          
                           inputMethodHints: Qt.ImhNoPredictiveText
          
                           onTextChanged: {
                               if (anchorselection.search !== textInput.text)
                                   anchorselection.checkPost_Search(textInput.text)
          
                           }
                       }
          
          ekkescornerE Offline
          ekkescornerE Offline
          ekkescorner
          Qt Champions 2016
          wrote on last edited by
          #4

          @Francky033 on Android and iOS you have to check if displayText changed to get each entered letter. getting text changed you know user hits ENTER
          I'm using onDisplayTextChanged for all my search fields
          curios: on macOS you get text changed for each letter

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
          5.15 --> 6.9 https://t1p.de/ekkeChecklist
          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

          1 Reply Last reply
          1
          • F Offline
            F Offline
            Francky033
            wrote on last edited by
            #5

            Thank you eekscorner!

            Changing onTextChanged to onDisplayTextChanged effectively sends a signal when typing on the keyboard.

            The problem is that textInput.text is equal to "" until the user presses ENTER or SPACE.

            How do I retrieve text from textInput while typing?

            Thanks !

            ekkescornerE 1 Reply Last reply
            0
            • F Francky033

              Thank you eekscorner!

              Changing onTextChanged to onDisplayTextChanged effectively sends a signal when typing on the keyboard.

              The problem is that textInput.text is equal to "" until the user presses ENTER or SPACE.

              How do I retrieve text from textInput while typing?

              Thanks !

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote on last edited by
              #6

              @Francky033 try to set textInput.text from onDisplayTextChanged

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
              5.15 --> 6.9 https://t1p.de/ekkeChecklist
              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Francky033
                wrote on last edited by
                #7

                After these modifications, everything works properly!

                Thank you all!

                TextInput {
                                   id: textInput
                                   y: 25
                
                                   height: 30
                                   color: "#ffffff"
                                   anchors.right: busyIndicator.left
                                   anchors.rightMargin: 10
                                   anchors.left: image3.right
                                   anchors.leftMargin: 10
                                   anchors.bottom: parent.bottom
                                   anchors.bottomMargin: 0
                                   activeFocusOnPress: anchorselection.Android
                                   focus: !anchorselection.Android
                                   cursorVisible: true
                                   font.family: "Tahoma"
                                   font.pixelSize: 20
                
                                   Rectangle {
                                       color: "#1e252f"
                                       anchors.fill: parent
                                       z: -1
                                   }
                
                                   inputMethodHints: Qt.ImhNoPredictiveText
                
                                   onDisplayTextChanged: {
                                       if (anchorselection.search !== textInput.displayText)
                                           anchorselection.checkPost_Search(
                                                       textInput.displayText)
                
                                   }
                               }
                
                1 Reply Last reply
                2

                • Login

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