Q_PROPERTY_FULL(int, READ int value() noexcept,
WRITE void setValue(int),
NOTIFY void valueChanged())
Why all the ceremony? What people probably want is:
Q_DEFAULT_PROPERTY(int, value)
That would expand to:
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
public:
int value() const { return m_value; }
void setValue(int value)
{
if (value == m_value)
return;
m_value = value;
Q_EMIT valueChanged();
}
Q_SIGNALS:
void valueChanged();
private:
int m_value = {};
Now you just need to make sure you keep your Q_DEFAULT_PROPERTY in the
private section of your class and you're fine. The capital "V" in
"setValue" is probably challenging to express in a macro but otherwise
this should be trivial.
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development