diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-10-17 14:48:59 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-02-21 10:55:13 +0000 |
commit | 2c16e0c30c6c5ed12af52ecac2cda128487cb379 (patch) | |
tree | 2aeb8f1bf4a140c782674329f62e1058b706684a /src/quick | |
parent | 99e2356a734fa3eb55ffc2e983658d17ab4c3e9f (diff) |
QQmlDelegateModel: guard new row/column properties with revision 12
Tag the new 'row' and 'column' properties with revision 12.
This will make sure that they cannot be accessed by the delegate
unless the QQmlAdaptorModel has the correct minorVersion set.
Fixes: QTBUG-70031
Change-Id: I49e67c37ab5b7925c7bca313bbb99f04d1387cc4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 12 | ||||
-rw-r--r-- | src/quick/items/qquicktableview_p_p.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index eaf0e4cf89..9949f083b1 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1515,6 +1515,17 @@ void QQuickTableViewPrivate::fixup(QQuickFlickablePrivate::AxisData &data, qreal QQuickFlickablePrivate::fixup(data, minExtent, maxExtent); } +int QQuickTableViewPrivate::resolveImportVersion() +{ + const auto data = QQmlData::get(q_func()); + if (!data || !data->propertyCache) + return 0; + + const auto cppMetaObject = data->propertyCache->firstCppMetaObject(); + const auto qmlTypeView = QQmlMetaType::qmlType(cppMetaObject); + return qmlTypeView.minorVersion(); +} + void QQuickTableViewPrivate::createWrapperModel() { Q_Q(QQuickTableView); @@ -1524,6 +1535,7 @@ void QQuickTableViewPrivate::createWrapperModel() // common interface to any kind of model (js arrays, QAIM, number etc), and // help us create delegate instances. tableModel = new QQmlTableInstanceModel(qmlContext(q)); + tableModel->useImportVersion(resolveImportVersion()); model = tableModel; } diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index 2ed04f8d29..8a02d23694 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -334,6 +334,7 @@ public: void scheduleRebuildTable(QQuickTableViewPrivate::RebuildOptions options); void invalidateColumnRowPositions(); + int resolveImportVersion(); void createWrapperModel(); void initItemCallback(int modelIndex, QObject *item); |