[Interest] QML TextArea confusion

Jereme Lamothe jereme.lamothe at gmail.com
Mon Feb 10 23:44:30 CET 2014


On Mon, Feb 10, 2014 at 5:34 PM, Mark Gaiser <markg85 at gmail.com> wrote:
> On Mon, Feb 10, 2014 at 11:17 PM, Jereme Lamothe
> <jereme.lamothe at gmail.com> wrote:
>> Hey all. I'm writing a Qt Quick app, binding properties of various
>> Controls to a QObject subclass that can work it's C++ magic. One such
>> property, belonging to TextArea, is 'text'. I have a QObject subclass
>> with a QString to store what the user types, which is accessible to
>> QML via the Q_PROPERTY macro (with a read/write/notify).
>>
>> I'm finding that TextArea can successfully read the property from the
>> QObject subclass (I've given the QString a default value for debugging
>> purposes), but changes to the TextArea (user enters or removes text)
>> are not written back to it. Any thoughts on what I may be doing wrong?
>> I'm concerned I'm missing something obvious. I've created a simple
>> example which can be found at
>> https://github.com/ZestyMeta/Misc/tree/master/TextArea . FWIW this is
>> w/ Qt 5.2.1
>>
>> P.S. I'm unclear on the etiquette for including code on mailing lists,
>> let me know if I should add it inline in the future.
>
> This will probably work.
> Add this to your TextArea in QML:
>
> onTextChanged: {
>     TextBackend.text = text
> }

Cool, that does the trick. Thank you for your quick reply. Do you
think I should submit a bug report, or did I just miss something in
the documentation?



More information about the Interest mailing list