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. Cannot assign to non-existent property "onTextEdited" TextField QML?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 4 Posters 1.2k 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    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

    jsulmJ 1 Reply Last reply
    0
    • F filipdns

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      3
      • jsulmJ jsulm

        @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 ?

        F Offline
        F Offline
        filipdns
        wrote on last edited by
        #3

        @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 NP 1 Reply Last reply
        0
        • F filipdns

          @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 NP Offline
          Pradeep P NP Offline
          Pradeep P N
          wrote on last edited by Pradeep P N
          #4

          @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ïO 1 Reply Last reply
          1
          • Pradeep P NP 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.

            ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by
            #5

            @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
            0

            • Login

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