diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-03-04 12:18:52 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-04-02 09:43:13 +0000 |
commit | 4e5ff56a18dc7bb13680a8fbe30ba5aae2dfa206 (patch) | |
tree | 53b711b3c67576a734913ddcec650ca2251933d7 /src/qml/types/qqmlobjectmodel_p.h | |
parent | 5cd819d264a932eccbd9d155a81c3c07a2918433 (diff) |
QQmlInstanceModel: add variantValue()wip/propertycache-refactor
This is necessary in order to add valueRole API to Qt Quick Controls
2's ComboBox.
Make stringValue() non-virtual and have it just call
variantValue().toString().
Task-number: QTBUG-73491
Change-Id: Ic4ecf8370eb0bb8045a967bd589e54dfc1ac5263
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/qml/types/qqmlobjectmodel_p.h')
-rw-r--r-- | src/qml/types/qqmlobjectmodel_p.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h index 4ac4f1c65b..1284ba1780 100644 --- a/src/qml/types/qqmlobjectmodel_p.h +++ b/src/qml/types/qqmlobjectmodel_p.h @@ -79,7 +79,8 @@ public: virtual QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) = 0; virtual ReleaseFlags release(QObject *object) = 0; virtual void cancel(int) {} - virtual QString stringValue(int, const QString &) = 0; + QString stringValue(int index, const QString &role) { return variantValue(index, role).toString(); } + virtual QVariant variantValue(int, const QString &) = 0; virtual void setWatchedRoles(const QList<QByteArray> &roles) = 0; virtual QQmlIncubator::Status incubationStatus(int index) = 0; @@ -119,7 +120,7 @@ public: bool isValid() const override; QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override; ReleaseFlags release(QObject *object) override; - QString stringValue(int index, const QString &role) override; + QVariant variantValue(int index, const QString &role) override; void setWatchedRoles(const QList<QByteArray> &) override {} QQmlIncubator::Status incubationStatus(int index) override; |