[Development] QProperty and library coding guide
filippocucchetto at gmail.com
Thu Jul 16 17:01:51 CEST 2020
Il giorno gio 16 lug 2020 alle ore 11:21 Ulf Hermann
<ulf.hermann at qt.io> ha scritto:
> You may have noticed the "eventually" above. If you connect a signal to
> a slot, the evaluation mechanism is "eager": When the signal arrives,
> the slot is executed. You may delay the signal a bit by queuing it, or
> you may suppress subsequent signals of the same type by connecting them
> as "unique", but the fundamentals stay the same. Let's say you have a
> Rectangle class with width, height, and area members. The widthChanged()
> and heightChanged() signals are connected to a slot that calculates the
> area. If you change both width and height in short succession, the area
> will be calculated twice. The intermediate value may be way off the mark
> and violate some expectations elsewhere in your code.
And how it should work in case i wanted to display that value on a
QQuick Text item
and someone change the height or the width? Who is in charge to
triggered the "read"
of the property?
Alternative solution with Qt5 tech: use QSize and change both
More information about the Development