[Qt-components] Validation of properties in the proposed Calendar API

Mitch Curtis mitch.curtis at digia.com
Wed Jan 16 18:46:38 CET 2013


On Wednesday, January 16, 2013 02:07:52 PM Michael Hasselmann wrote:
> Why not have a separate validator component listening to the
> selectedDate property? If the validator doesn't like the current value,
> it will reset it to a valid one (or last valid one).
> 
> So yes, others listening to that property will temporarily see a wrong
> value, if someone sets an incorrect date. But "temporary" should be in
> the ms range.

Can you please elaborate on this? You mentioned a QML plugin for this purpose 
on IRC - do you mean a C++ type exposed to QML [1]?

> BTW: Binding loops don't have to be wrong per se. It could be a
> self-stabilizing system that stops changing after n iterations.

In my case I was actually getting an error, rather than a warning. I'd rather 
not cause binding loops if there is a proper way to do it. The other problem 
with this is that I'd need to add this "stop after n iterations" flag for every 
property I want to validate (e.g. minimumDate and maximumDate) in the onChange 
handler.

[1] http://qt-project.org/doc/qt-4.8/qdeclarativeextensionplugin.html



More information about the Qt-components mailing list