forked from qt-creator/qt-creator
Utils: Add operator() as a way to access .value() for some aspects
This can make the user code look a bit nicer. Change-Id: I98867114810ede2f04342144f600682ff3c261b4 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -229,6 +229,7 @@ public:
|
|||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
void emitChangedValue() override;
|
void emitChangedValue() override;
|
||||||
|
|
||||||
|
bool operator()() const { return value(); }
|
||||||
bool value() const;
|
bool value() const;
|
||||||
void setValue(bool val);
|
void setValue(bool val);
|
||||||
bool defaultValue() const;
|
bool defaultValue() const;
|
||||||
@@ -372,6 +373,8 @@ public:
|
|||||||
// Hook between UI and StringAspect:
|
// Hook between UI and StringAspect:
|
||||||
using ValueAcceptor = std::function<std::optional<QString>(const QString &, const QString &)>;
|
using ValueAcceptor = std::function<std::optional<QString>(const QString &, const QString &)>;
|
||||||
void setValueAcceptor(ValueAcceptor &&acceptor);
|
void setValueAcceptor(ValueAcceptor &&acceptor);
|
||||||
|
|
||||||
|
QString operator()() const { return value(); }
|
||||||
QString value() const;
|
QString value() const;
|
||||||
void setValue(const QString &val);
|
void setValue(const QString &val);
|
||||||
|
|
||||||
@@ -449,6 +452,7 @@ public:
|
|||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
|
|
||||||
|
qint64 operator()() const { return value(); }
|
||||||
qint64 value() const;
|
qint64 value() const;
|
||||||
void setValue(qint64 val);
|
void setValue(qint64 val);
|
||||||
|
|
||||||
@@ -486,6 +490,7 @@ public:
|
|||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
|
|
||||||
|
double operator()() const { return value(); }
|
||||||
double value() const;
|
double value() const;
|
||||||
void setValue(double val);
|
void setValue(double val);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user