Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Cannot assign to non-existent property "onTextEdited" TextField QML?

    QML and Qt Quick
    4
    5
    694
    Loading More Posts
    • 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
      filipdns last edited by

      Hello,

      with QT 5.14 on windows 64, following documentation saying:

      **textEdited()

      This signal is emitted whenever the text is edited. Unlike textChanged(), this signal is not emitted when the text is changed programmatically, for example, by changing the value of the text property or by calling clear().

      The corresponding handler is onTextEdited.

      This signal was introduced in Qt 5.9.
      **

      I received message Cannot assign to non-existent property "onTextEdited" using code:

      import QtQuick 2.14
      
      TextField {
                  id: searchInput
                  width:500
                  placeholderText:"Part Number, serial number, description"
                  font.pixelSize: 20
                  anchors.top:parent.top
                  anchors.left:parent.left
                  anchors.margins:10
                  activeFocusOnPress: true
                  activeFocusOnTab: true
                  focus: true
                  selectByMouse: true
                  onTextEdited: console.log(searchInput.text)
              }
      

      I don't understand why, could you help me please?

      Thanks a lot

      Philippetexte en italique

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @filipdns last edited by

        @filipdns Do you use https://doc.qt.io/qt-5/qml-qtquick-controls2-textfield.html or https://doc.qt.io/qt-5/qml-qtquick-controls-textfield.html ?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        F 1 Reply Last reply Reply Quote 3
        • F
          filipdns @jsulm last edited by

          @jsulm Hi,

          I solve this with:

          FocusScope
          { id: searchInput
              width: 500;
              height: 28
              signal textEditedSignal(string msg)
              TextInput {
                  id: textInput
                  anchors.fill:parent
                  font.pixelSize: globalScaleFactor* 20
                  selectByMouse: true
                  onTextEdited: { searchInput.textEditedSignal(textInput.text); console.log( textInput.text)}
              }
          }
          
          Pradeep P N 1 Reply Last reply Reply Quote 0
          • Pradeep P N
            Pradeep P N @filipdns last edited by Pradeep P N

            @filipdns
            Cool.

            TextField { } and TextInput { } are different components, ( Links provided by @jsulm above )

            TextField { } is part of Qt Quick Controls & hence its not available with import QtQuick 2.14 .

            All the best.

            Pradeep Nimbalkar.
            Upvote the answer(s) that helped you to solve the issue...
            Keep code clean.

            ODБOï 1 Reply Last reply Reply Quote 1
            • ODБOï
              ODБOï @Pradeep P N last edited by

              @Pradeep-P-N said in Cannot assign to non-existent property "onTextEdited" TextField QML?:

              TextField { } and TextInput { } are completely different components

              TextField is actually a TextInput

              1 Reply Last reply Reply Quote 0
              • First post
                Last post