summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-27 14:02:59 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-06 14:25:12 +0200
commit549712830ba6e8cfe603d22a47190b15f60c7072 (patch)
treef4ce74b351c8b2d58d80b6b611e050498d1eae2c /src/gui
parentbee2bfc6c6b0d075eb4ba5cc2f158b2eabcbcbb6 (diff)
QProperty: Add support for member function change handlers
When a class has multiple QProperty members to implement functionality, it is common to have functions in the class that react to changes. For example to emit a compatibility signal, in case of Qt Quick to mark the scene graph as dirty, etc. etc. To faciliate this use-case, this patch adds an internal QPropertyMemberChangeHandler template that allows connecting a QProperty field to a member function callback. At the moment that callback is still 3 * sizeof(pointer). This could in theory be reduced to 2 by eliminating the back-pointer (prev) as the observer lives as long as the property. That however belongs into maybe a future patch. In order to get a pointer back to the surrounding object that holds the QProperty as well as provides the callback function, the property system was changed to pass through the address of the QProperty member at run-time, and at compile time the delta from the QProperty member to the beginning of the surrounding class is calculated. Through subtraction we obtain the pointer to the owning object. Change-Id: Ia2976357053f474ff44d0d6f60527c3b8e1f613a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/gui')
0 files changed, 0 insertions, 0 deletions