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. TextInput in qml: How to detect that user has completed typing

TextInput in qml: How to detect that user has completed typing

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 977 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.
  • N Offline
    N Offline
    Nelson_Piquet
    wrote on last edited by
    #1

    I am new to Qt & QML. I am using QtQuick 2.4. I have TextInput item with a signal defined in a qml file like below:

    import QtQuick 2.4
    
    TextInput {
      text: "Text"
      cursorVisible: true
    
      signal qmlSignal(string msg)
    }
    

    I also have a slot tied to the qmlSignal. I want to trigger the signal when user completes typing on the TextInput field or closes my qml page to go to another page in the application.

    What is the correct way to acheive this desired functionality ? I see that there is onEditingFinished(). How can I use onEditingFinished() here ? Can someone pls provide a sample

    Julien BJ 1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! I guess the editingFinished signal is what you're looking for.

      1 Reply Last reply
      3
      • N Nelson_Piquet

        I am new to Qt & QML. I am using QtQuick 2.4. I have TextInput item with a signal defined in a qml file like below:

        import QtQuick 2.4
        
        TextInput {
          text: "Text"
          cursorVisible: true
        
          signal qmlSignal(string msg)
        }
        

        I also have a slot tied to the qmlSignal. I want to trigger the signal when user completes typing on the TextInput field or closes my qml page to go to another page in the application.

        What is the correct way to acheive this desired functionality ? I see that there is onEditingFinished(). How can I use onEditingFinished() here ? Can someone pls provide a sample

        Julien BJ Offline
        Julien BJ Offline
        Julien B
        wrote on last edited by Julien B
        #3

        Hello @Nelson_Piquet ,

        You can use signal handler like this:

        TextInput {
            text: "Text"
            cursorVisible: true
        
            signal qmlSignal(string msg)
        
            onEditingFinished: {
                qmlSignal (text);
            }
        
            onQmlSignal: {
                console.log(msg)
            }
        }
        
        N 1 Reply Last reply
        1
        • Julien BJ Julien B

          Hello @Nelson_Piquet ,

          You can use signal handler like this:

          TextInput {
              text: "Text"
              cursorVisible: true
          
              signal qmlSignal(string msg)
          
              onEditingFinished: {
                  qmlSignal (text);
              }
          
              onQmlSignal: {
                  console.log(msg)
              }
          }
          
          N Offline
          N Offline
          Nelson_Piquet
          wrote on last edited by
          #4

          @Julien-B thanks a lot

          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