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. No textEdited() for TextArea QML Type
Qt 6.11 is out! See what's new in the release blog

No textEdited() for TextArea QML Type

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 3 Posters 849 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.
  • S Offline
    S Offline
    shemeshg
    wrote on last edited by shemeshg
    #1

    Why is theere no textEdited() for TextArea QML Type?

    While TextInput ( https://doc.qt.io/qt-6/qml-qtquick-textinput.html#:~:text=editingFinished()-,textEdited(),-Methods ) Has it though...

    How would I implement that myself in the QML
    (https://doc.qt.io/qt-6/qml-qtquick-controls2-textarea.html)?

    JoeCFDJ 1 Reply Last reply
    0
    • S shemeshg

      Why is theere no textEdited() for TextArea QML Type?

      While TextInput ( https://doc.qt.io/qt-6/qml-qtquick-textinput.html#:~:text=editingFinished()-,textEdited(),-Methods ) Has it though...

      How would I implement that myself in the QML
      (https://doc.qt.io/qt-6/qml-qtquick-controls2-textarea.html)?

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      @shemeshg onEditingFinished()?

      S 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @shemeshg onEditingFinished()?

        S Offline
        S Offline
        shemeshg
        wrote on last edited by shemeshg
        #3

        @JoeCFD This will not satisfy the requirements.of `textEdited().

        onEditedFinished() is only when lost focus, or deliberately pressed enter.
        It will not continuously processes your keyboard input.

        onTextEdited(), is like onChanged() but only when user perform the change (and not code)

        P 1 Reply Last reply
        0
        • S shemeshg

          @JoeCFD This will not satisfy the requirements.of `textEdited().

          onEditedFinished() is only when lost focus, or deliberately pressed enter.
          It will not continuously processes your keyboard input.

          onTextEdited(), is like onChanged() but only when user perform the change (and not code)

          P Offline
          P Offline
          pavanbellary
          wrote on last edited by
          #4

          @shemeshg, You can check for

          onTextEdited
          

          signal for processing the real time text changes.

          S 1 Reply Last reply
          0
          • P pavanbellary

            @shemeshg, You can check for

            onTextEdited
            

            signal for processing the real time text changes.

            S Offline
            S Offline
            shemeshg
            wrote on last edited by shemeshg
            #5

            @pavanbellary Checked, but it does not exists

            The error msg.

            qrc:/untitled/main.qml:11:9: Cannot assign to non-existent property "onTextEdited"
            

            The code

            import QtQuick
            import QtQuick.Controls
            
            Window {
                width: 640
                height: 480
                visible: true
                title: qsTr("Hello World")
            
                TextArea {
                    onTextEdited: {
                        console.log("asdasd");
                    }
                }
            }
            
            

            It is also missing in the documentation of Qt6.4

            P 1 Reply Last reply
            0
            • S shemeshg

              @pavanbellary Checked, but it does not exists

              The error msg.

              qrc:/untitled/main.qml:11:9: Cannot assign to non-existent property "onTextEdited"
              

              The code

              import QtQuick
              import QtQuick.Controls
              
              Window {
                  width: 640
                  height: 480
                  visible: true
                  title: qsTr("Hello World")
              
                  TextArea {
                      onTextEdited: {
                          console.log("asdasd");
                      }
                  }
              }
              
              

              It is also missing in the documentation of Qt6.4

              P Offline
              P Offline
              pavanbellary
              wrote on last edited by
              #6

              @shemeshg , sorry, use onTextChanged signal which is associated with property of text.

              S 1 Reply Last reply
              0
              • P pavanbellary

                @shemeshg , sorry, use onTextChanged signal which is associated with property of text.

                S Offline
                S Offline
                shemeshg
                wrote on last edited by
                #7

                @pavanbellary onTextChanged will not provide onTextEdited() desired functionality

                because it will also be triggered

                1. when the component is initialized,
                2. when changes triggered programmatically by other component or emitter.

                Imagine Editor, and you want a notification only for none saved changes made by the user..

                You might think of onKeyPressed as solution, but then you'll have to filter all the Control+Whatever, and none printable keyboard shortcut.

                Modifying onKeyPressed will not be an easy task either, because you will have to maintain a flag for every "Silent key" (like Alt,Ctrl,Cmd, shift etc...)

                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