textEdited signal for TextArea/TextEdit
-
The TextInput component has a very useful signal which is emitted only when the user actively types into the keyboard: https://doc.qt.io/qt-6/qml-qtquick-textinput.html#textEdited-signal. This lets the program change the text without triggering signals.
Is there something similar for TextEdit/TextArea components? https://doc.qt.io/qt-6/qml-qtquick-textedit.html#editingFinished-signal is all I can find, and this will trigger only when the user changes focus. That's not really the same thing at all.
Thoughts?
-
when you have a property (starting with a lowercase) in QML, you should have the corresponding propertyChanged signal available, and you can autoconnect to same Item's onPropertyChanged slot.
As stated in TextInput's documentation, textEdited is not emitted when text has changed programmatically, hence only when the text has changed by UI action. textChanged is emitted whenever the text has changed no matter where the change comes from.
-
@ankou29666 Thanks for your thoughts. I think all that is understood. The problem is that when we programmatically change the text this triggers
onTextChanged
, and thus causes nasty loops when the text changes cause text changes (which is what is what happens when there are multiple text blocks and they all need to be sync'ed with each other).textEdited()
breaks the cycle by allowing the signal to fire only when the user types new text, not just when the text is changed. -
Sorry for bumping this old thread, but: this feature is still missing, right? Is anyone aware of a bugtracker issue for this? I could not find one...
-
Bug is here https://bugreports.qt.io/browse/QTBUG-103718
Fix is also under progress.