[Development] The future of QProperty and QBindable

Thiago Macieira thiago.macieira at intel.com
Fri Mar 7 16:32:43 CET 2025


On Friday, 7 March 2025 03:51:23 Pacific Standard Time Volker Hilsheimer via 
Development wrote:
> class Object : public QObject
> {
>     Q_OBJECT
>     Q_PROPERTY(value)

It would be easier to keep the current syntax with READ, WRITE, NOTIFY and 
then add an extra boolean field that tells moc to implement the getter and 
setter.

> public:
>     // ~~~
> 
>     int value() const;
>     void setValue() const;
> 
> signals:
>     void valueChanged();
> };

Or something like:

class Object : public QObject
{
    Q_OBJECT
public:
    Q_PROPERTY_FULL(int, READ, int value() noexcept, 
                    WRITE, void setValue(int),
                    NOTIFY, void valueChanged())
};

It shouldn't be too difficult to make the macro output all positive even-
numbered fields into the header. Or if we can find a way to insert a prefix that 
then turns the word into a macro that expands to empty:

    Q_PROPERTY_FULL(int, READ int value() noexcept, 
                    WRITE void setValue(int),
                    NOTIFY void valueChanged())

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5150 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20250307/cb0f2bb6/attachment.bin>


More information about the Development mailing list