[Development] QProperty and library coding guide
Ville Voutilainen
ville.voutilainen at gmail.com
Wed Jul 22 00:14:27 CEST 2020
On Wed, 22 Jul 2020 at 00:18, Volker Hilsheimer <volker.hilsheimer at qt.io> wrote:
> With the current design, notational convenience doesn’t work either:
>
> auto text = qAction->text;
> text.left(10); // booh
>
> ‘text’ is not a QString, but a QAction::_qt_property_api_text object, with broken... everythings.
>
>
> And if people can’t use auto, then you can’t use standard ranged-for to iterate over container type properties without spelling everyhing out. That’s ... not convenient, I suppose. And that problem persists, even if we expose a e.g QProperty<QStringList> reference through a public property member.
Couldn't we add operator-> and begin/end to the property type?
> The current implementation also adds, in case of us not being able to use no_unique_address, a byte or even a pointer to each class in a class hierarchy, bloating classes down in the inheritance tree. Plus the BC challenge that might come with in the long run.
> So, this is not only a problem of UB. There is well defined behavior that seems to get in the way.
Ack.
More information about the Development
mailing list