onEditingFinished is not available due to component versioning
-
wrote on 28 Mar 2017, 00:17 last edited by
QtCreator included this:
import QtQuick 2.7Would I need that and QtQuick.Controls? (newbie question)
I tried adding it, and also tried versions 1.3 and 1.4. No improvement.
-
QtCreator included this:
import QtQuick 2.7Would I need that and QtQuick.Controls? (newbie question)
I tried adding it, and also tried versions 1.3 and 1.4. No improvement.
wrote on 28 Mar 2017, 00:20 last edited by ambershark@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.
-
wrote on 28 Mar 2017, 17:08 last edited by
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!
-
wrote on 28 Mar 2017, 18:56 last edited by
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") } }
-
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") } }
wrote on 29 Mar 2017, 16:23 last edited by@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.
-
@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.
wrote on 29 Mar 2017, 17:24 last edited by -
wrote on 30 Mar 2017, 23:49 last edited by
I was looking at the wrong docs. That signal existed in Quick, but not in Quick 2.
-
wrote on 31 Mar 2017, 08:27 last edited by
@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 -
wrote on 3 Apr 2017, 14:48 last edited by
Looks like an unfortunate bug in the property/signal revisioning system. Could you report at bugreports.qt.io?
-
wrote on 3 Apr 2017, 14:49 last edited by
Here's one possible workaround:
Connections { target: textField1 onEditingFinished: { console.log("Editing finished text: " + textField1.text); } }
-
Here's one possible workaround:
Connections { target: textField1 onEditingFinished: { console.log("Editing finished text: " + textField1.text); } }
wrote on 3 Apr 2017, 16:01 last edited by@jpnurmi Thank you for your time. I've reported the issue as QTBUG-59908.
12/13