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

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

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 1.0k Views 2 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.
  • N Offline
    N Offline
    Nelson_Piquet
    wrote on 27 Oct 2016, 20:32 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

    J 1 Reply Last reply 28 Oct 2016, 07:08
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 27 Oct 2016, 20:46 last edited by
      #2

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

      1 Reply Last reply
      3
      • N Nelson_Piquet
        27 Oct 2016, 20:32

        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

        J Offline
        J Offline
        Julien B
        wrote on 28 Oct 2016, 07:08 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 28 Oct 2016, 07:23
        1
        • J Julien B
          28 Oct 2016, 07:08

          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 28 Oct 2016, 07:23 last edited by
          #4

          @Julien-B thanks a lot

          1 Reply Last reply
          0

          1/4

          27 Oct 2016, 20:32

          • Login

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