https://bugs.kde.org/show_bug.cgi?id=514218
Bug ID: 514218
Summary: FormTextFieldDelegate: binding of text property breaks
in TextField's onTextChanged
Classification: Frameworks and Libraries
Product: kirigami-addons
Version First 1.10.0
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
SUMMARY
```
FormCard.FormTextFieldDelegate {
id: tfd
label: "ABC"
text: btn.data // this binding breaks
trailing: Button {
id: btn
property string data: "abc"
text: data
onClicked: btn.data = btn.data+"1"
}
}
```
The binding is broken in FormCard.FormTextFieldDelegate.qml
https://invent.kde.org/libraries/kirigami-addons/-/blob/313d7c83a105bcb9aa3a3fac0941b5d5c2c6730d/src/formcard/FormTextFieldDelegate.qml#L301
STEPS TO REPRODUCE
1. run above sample
2. click button
OBSERVED RESULT
button text changes, but FormTextFieldDelegate text doesn't change
EXPECTED RESULT
FormTextFieldDelegate text changes too
SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.3-arch1-1 (64-bit)
Graphics Platform: Wayland
POSSIBLE SOLUTIONS
Using Synchronizer
https://doc.qt.io/qt-6/qml-qt-labs-synchronizer-synchronizer.html
```
AbstractFormDelegate {
id: root
TextField {
id: textField
// text: root.text
// onTextChanged: root.text = text
Synchronizer on text {
property alias source: root.text
}
}
}
```
Using an alias for textField.text
```
AbstractFormDelegate {
id: root
property alias fieldText: textField.text
TextField {
id: textField
// text: root.text
// onTextChanged: root.text = text
}
}
```
--
You are receiving this mail because:
You are watching all bug changes.