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. onEditingFinished is not available due to component versioning
Forum Updated to NodeBB v4.3 + New Features

onEditingFinished is not available due to component versioning

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 4 Posters 7.0k Views 4 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.
  • D DanCA-A

    QtCreator included this:
    import QtQuick 2.7

    Would I need that and QtQuick.Controls? (newbie question)

    I tried adding it, and also tried versions 1.3 and 1.4. No improvement.

    A Offline
    A Offline
    ambershark
    wrote on last edited by ambershark
    #4

    @DanCA-A Yea you need to add the controls line too, it should looks like this:

    import QtQuick 2.7
    import QtQuick.Controls 2.1
    

    Edit: that is for 5.8 though I think, you may need to adjust the versions for your 5.7 app.

    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DanCA-A
      wrote on last edited by
      #5

      It's QtQuick.Controls 2.0 for 5.7.1, but that still didn't fix it.

      I ended up switch to the "accepted" signal instead of "editingFinished".

      As far as I can tell the latter is either broken or mis-documented. Is there someplace I should file a bug?

      Thanks for the tips, though!

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

        Works for me with Qt 5.8.0:

        import QtQuick 2.7
        import QtQuick.Controls 2.1
        
        ApplicationWindow {
            visible: true
            width: 640
            height: 480
        
            TextField {
                text: "nx"
                anchors.centerIn: parent
                onEditingFinished: console.log("Hello")
            }
        }
        
        D 1 Reply Last reply
        0
        • ? A Former User

          Works for me with Qt 5.8.0:

          import QtQuick 2.7
          import QtQuick.Controls 2.1
          
          ApplicationWindow {
              visible: true
              width: 640
              height: 480
          
              TextField {
                  text: "nx"
                  anchors.centerIn: parent
                  onEditingFinished: console.log("Hello")
              }
          }
          
          D Offline
          D Offline
          DanCA-A
          wrote on last edited by
          #7

          @Wieland That does work, but it's not how qtcreator does things. Being new to Qt, I'm pretty dependent on the tools to help me get going.

          It's doing layout in one file and attaching handlers in another. That isn't working.

          Page1Form.ui.qml

          import QtQuick 2.7
          import QtQuick.Controls 2.0
          import QtQuick.Layouts 1.0
          
          Item {
              property alias textField1: textField1
              property alias button1: button1
          
              RowLayout {
                  anchors.horizontalCenter: parent.horizontalCenter
                  anchors.topMargin: 20
                  anchors.top: parent.top
          
                  TextField {
                      id: textField1
                      placeholderText: qsTr("Text Field")
                  }
          
                  Button {
                      id: button1
                      text: qsTr("Press Me")
                  }
              }
          }
          

          Page1.qml

          import QtQuick 2.7
          import QtQuick.Controls 2.0
          
          Page1Form {
              textField1.onAccepted: {
                  console.log("Accepted text: " + textField1.text);
              }
              /*textField1.onEditingFinished: {
                  console.log("Editing finished text: " + textField1.text);
              }*/
              button1.onClicked: {
                  console.log("Button Pressed. Entered text: " + textField1.text);
              }
          }
          

          Uncomment the above code to see the problem.

          ? 1 Reply Last reply
          1
          • D DanCA-A

            @Wieland That does work, but it's not how qtcreator does things. Being new to Qt, I'm pretty dependent on the tools to help me get going.

            It's doing layout in one file and attaching handlers in another. That isn't working.

            Page1Form.ui.qml

            import QtQuick 2.7
            import QtQuick.Controls 2.0
            import QtQuick.Layouts 1.0
            
            Item {
                property alias textField1: textField1
                property alias button1: button1
            
                RowLayout {
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.topMargin: 20
                    anchors.top: parent.top
            
                    TextField {
                        id: textField1
                        placeholderText: qsTr("Text Field")
                    }
            
                    Button {
                        id: button1
                        text: qsTr("Press Me")
                    }
                }
            }
            

            Page1.qml

            import QtQuick 2.7
            import QtQuick.Controls 2.0
            
            Page1Form {
                textField1.onAccepted: {
                    console.log("Accepted text: " + textField1.text);
                }
                /*textField1.onEditingFinished: {
                    console.log("Editing finished text: " + textField1.text);
                }*/
                button1.onClicked: {
                    console.log("Button Pressed. Entered text: " + textField1.text);
                }
            }
            

            Uncomment the above code to see the problem.

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #8

            @DanCA-A You are right, I can reproduce it with Qt 5.8.0. It looks like a bug in QQuickTextInput to me. Maybe @jpnurmi can have a look at it, please? :-)

            1 Reply Last reply
            1
            • D Offline
              D Offline
              DanCA-A
              wrote on last edited by
              #9

              I was looking at the wrong docs. That signal existed in Quick, but not in Quick 2.

              ? 1 Reply Last reply
              1
              • D DanCA-A

                I was looking at the wrong docs. That signal existed in Quick, but not in Quick 2.

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #10

                @DanCA-A Wrong, TextField has that signal in QuickControls 2:

                https://doc.qt.io/qt-5/qml-qtquick-controls2-textfield.html
                https://doc.qt.io/qt-5/qml-qtquick-controls2-textfield-members.html
                https://doc.qt.io/qt-5/qml-qtquick-textinput.html#editingFinished-signal

                1 Reply Last reply
                0
                • jpnurmiJ Offline
                  jpnurmiJ Offline
                  jpnurmi
                  wrote on last edited by
                  #11

                  Looks like an unfortunate bug in the property/signal revisioning system. Could you report at bugreports.qt.io?

                  1 Reply Last reply
                  0
                  • jpnurmiJ Offline
                    jpnurmiJ Offline
                    jpnurmi
                    wrote on last edited by
                    #12

                    Here's one possible workaround:

                        Connections {
                            target: textField1
                            onEditingFinished: {
                                console.log("Editing finished text: " + textField1.text);
                            }
                        }
                    
                    ? 1 Reply Last reply
                    1
                    • jpnurmiJ jpnurmi

                      Here's one possible workaround:

                          Connections {
                              target: textField1
                              onEditingFinished: {
                                  console.log("Editing finished text: " + textField1.text);
                              }
                          }
                      
                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #13

                      @jpnurmi Thank you for your time. I've reported the issue as QTBUG-59908.

                      1 Reply Last reply
                      1

                      • Login

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