[Development] QProperty and when evaluation occurs

Arno Rehn a.rehn at menlosystems.com
Thu Jul 23 22:08:05 CEST 2020


Hi Brett,

Am 23.07.2020 um 15:56 schrieb Stottlemyer, Brett (B.S.):
> I'm still trying to wrap my head around this concept, and starting a new 
> thread to distinguish from the technical implementation discussion.
> 
> The two obvious cases:
> * Immediate evaluation.  This is the current signal-based handling 
> (ignoring queued for the moment).
> * Evaluate-on-Read (EoR).  True lazy evaluation, where computations 
> would never be made if no one asks.  Kind of the opposite of CoW.
> 
> EoR, though, seems not too useful in many cases; it seems to shift 
> backwards towards polling.  I expect Qt's HMI technologies (Widgets, 
> QML, 3D) to have to shift(?) to the third case:
> * Render evaluation.  When the render runs (nominally 30 or 60 frames 
> per second), all "dirty" elements are evaluated, and the dirty flag is 
> cleared.  In this case, the evaluation is lazy, but the task of figuring 
> out when to evaluate is handled by the renderer, not passed on to the user.

I think much of the confusion stems from the fact that you can get 
notifications (i.e. callbacks) without evaluating the whole binding.
 From what I grok from the code, you can subscribe to "dirty" flag 
changes with onValueChanged/subscribe - but this does not evaluate the 
property binding. Evaluation is only done when your handler routine 
actually requests the property value.
(Note that in that case "onValueChanged" might be a misnomer - the value 
might not have actually changed, even though a changed dependency has 
lead to it being flagged dirty).

If the goal is, however, to really get rid of all the ways to get 
notified about (possibly) changed properties, then this system is 
defective IMHO. Constant-rate polling with a timer might be a good 
solution for *some* problems, but it leads to absolutely abysimal 
performance in others (or many wasted resources). But I don't think this 
is what is proposed.

Anyone with more knowledge: please correct me if I'm wrong.

Regards,
Arno

-- 
Arno Rehn
Tel +49 89 189 166 0
Fax +49 89 189 166 111
a.rehn at menlosystems.com
www.menlosystems.com

Menlo Systems GmbH
Am Klopferspitz 19a, 82152 Martinsried, Germany
Amtsgericht München HRB 138145
Geschäftsführung: Dr. Michael Mei, Dr. Ronald Holzwarth
USt.-IdNr. DE217772017, St.-Nr. 14316170324


More information about the Development mailing list