> On 16 Jul 2020, at 18:45, Thiago Macieira <thiago.macie...@intel.com> wrote:
> 
> On Thursday, 16 July 2020 08:40:35 PDT Volker Hilsheimer wrote:
>> action->text = document->title; // still no binding
>> action->text = Qt::makePropertyBinding(document->title); // yay binding!
>> 
>> 
>> These struct-methods are either inline forwards, or implemented by moc, and
>> we need a differently named but identical struct for each property.
>> 
>> The struct has no data itself, so ideally would be of size zero.
> 
> That didn't answer how they can share an address. Suppose I have two 
> properties of type QString called "text" and "title".
> 
>  action->text = "foo";
>  action->title = "bar";
> 
> 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.

Volker

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to