CONSTANT is often used when the value of a property does not change after it is set, " Slice Master" that is, it is a constant.
A property declared as CONSTANT cannot be changed after it is first set.
CONSTANT is only suitable when you want a fixed value throughout the life of the object
class MyClass : public QObject {
Q_OBJECT
public:
MyClass(QObject *parent = nullptr) : QObject(parent) {}
Q_PROPERTY(int maxValue READ maxValue CONSTANT)
private:
int maxValue() const { return 100; }};
Bookmarks