[Development] QProperty and library coding guide
volker.hilsheimer at qt.io
Thu Jul 16 21:02:39 CEST 2020
> On 16 Jul 2020, at 19:54, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On Thursday, 16 July 2020 10:36:27 PDT Volker Hilsheimer wrote:
>>> Since std::is_same_v<decltype(action->text), decltype(action->title)> and
>>> &action->text == &action->title, how does the code above even work?
>> calls QAction::_qt_property_api_text::structMemberFunction, which is
>> implemented by moc to operate on d->text
>> calls QAction::_qt_property_api_title::structMemberFunction, which is
>> implemented by moc to operate on d->title.
>> The structMemberFunctions are different for each property, but that doesn't
>> increase the size of QAction instances.
>> The relevant macros are defined in qtmetamacros.h.
> In other words, action->text and action->title aren't the same type.
Correct, I see that my earlier statement that “each property is represented by an instance of a struct” was misleading.
More information about the Development