[Development] QProperty and when evaluation occurs

Stottlemyer, Brett (B.S.) bstottle at ford.com
Fri Jul 24 14:32:11 CEST 2020


Hi Arno,

On 7/23/20, 4:14 PM, "Arno Rehn" <a.rehn at menlosystems.com> wrote:

    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).
    
Thanks for this explanation.  My question below is related to your comment, but not necessarily directed at you (Arno).

If I subscribe a callback to a QProperty, does it get called once or more than once?  I.e., if the property is area, which depends on x and y, and both x and y are changed, do I get called only when the first is updated?  Or both?

    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.

Agreed.

Brett



More information about the Development mailing list