[Development] QProperty and library coding guide

Thiago Macieira thiago.macieira at intel.com
Thu Jul 16 19:54:59 CEST 2020


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?
> 
> action->text.structMemberFunction();
> 
> calls QAction::_qt_property_api_text::structMemberFunction, which is
> implemented by moc to operate on d->text
> 
> whereas
> 
> action->title.structMemberFunction();
> 
> 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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Development mailing list