> On 15 Dec 2023, at 16:19, Sune Vuorela <[email protected]> wrote:
>
> On 2023-12-15, Elias Steurer via Development <[email protected]>
> wrote:
>> No, I still need all the get/set/notify functions to change/get the
>> variables from the outside. There is currently no way to do that, or am
>> I missing something? Something like this
>> https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlayUtil/inc/public/ScreenPlayUtil/PropertyHelpers.h?ref_type=heads#L52
>> but as a standardized Qt macro.
>
> My experience, after having written a few macros like that out of
> projects, is that it is a bad idea, unless it is really thought thru.
>
> What I have seen is that it encourages all properties to be
> read/write/notify where at least many of them was only supposed to be
> read/notify or read/constant.
>
> /Sune
Would it help/be a bad idea if moc would identify member functions that match
the Qt naming convention so that you can reduce the boiler plate, e.g.
class Thing
{
Q_PROPERTY(QString text)
public:
void setText(const QString &text); // obviously the setter
QString text() const; // evidently the getter
signals:
textChanged(const QString &text); // there’s a notification signal
};
Doesn’t help you if you use snake case, but *could* perhaps be configurable
with a command line option.
Volker
--
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development