>
> Removing boilerplate from a C++ class that declares properties could be done
> with the help of moc, without creating bindables. I.e. a simplified
> Q_PROPERTY declaration that assumes some convention for
> getter/setter/notify-signal could be enough:
>
> class Object : public QObject
> {
>     Q_OBJECT
>     Q_PROPERTY(value)
> public:
>     // ~~~
>
>     int value() const;
>     void setValue() const;
>
> signals:
>     void valueChanged();
> };
>
> This declaration should have enough information for moc to create the
> necessary metaobject-data. it might require some non-trivial work on moc’s
> parser, I suspect, but that’s perhaps a better use of our time.
>

I have nothing against a workable replacement solution in principle (it's work 
to implement it, but that's life).
However, what you suggest doesn't hit the target:
1) Specifying the attributes of Q_PROPERTY is not the problem. This is 
straightforward, and typically just does not work at all if you forget 
something. Mostly.
2) Tying Q_PROPERTY to specific names for getter and signal is a bad idea 
anyway. This would mean more totally unnecessary changes for existing projects 
(except if it's just an option to use that notation, in which case I would not 
care to use it)
3) The real boilerplate I talk about is the change comparison. It's easy to 
forget (things work even if you don't do it), but at worst, the application 
might crash as certain values trigger an endless recursion.

Kind regards

Robert


________________________________

This message and any attachments are solely for the use of the intended 
recipients. They may contain privileged and/or confidential information or 
other information protected from disclosure. If you are not an intended 
recipient, you are hereby notified that you received this email in error and 
that any review, dissemination, distribution or copying of this email and any 
attachment is strictly prohibited. If you have received this email in error, 
please contact the sender and delete the message and any attachment from your 
system.

ANDRITZ HYDRO GmbH


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806


Thank You
________________________________
-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to