aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/util
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-06 15:53:16 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-09 16:58:13 +0000
commit7d55fb4029f4cc9bc5e5b4cef7ef5a456d42f83f (patch)
tree2be582752ffde4fa72dbe67c5528b963cd11b143 /src/qml/util
parent90fea15e0dfc62ecd668d1b0462d121dba5c1b7e (diff)
QQmlDelegateModelItem: move row and column up to the base class
Change 8c33c70 injected row and column (alongside index) into the QML context of a delegate when the view had a QAbstractItemModel as model. Rather than only inject those properties when using QAIM, this patch will move the code to the base class. This way, if a view uses e.g a javascript list as model, row and column is still be available. This is useful, since then the delegate can bind to both row and column regardless of what kind of model the view uses. In the case of a list model, the column property will always be 0. Change-Id: I1d9f11c0b7d7a5beb83198184ba12cc1e48cd100 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/qml/util')
-rw-r--r--src/qml/util/qqmladaptormodel.cpp30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 15844017aa..3016316e57 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -398,8 +398,6 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject
class QQmlDMAbstractItemModelData : public QQmlDMCachedModelData
{
Q_OBJECT
- Q_PROPERTY(int row MEMBER row NOTIFY rowChanged)
- Q_PROPERTY(int column MEMBER column NOTIFY columnChanged)
Q_PROPERTY(bool hasModelChildren READ hasModelChildren CONSTANT)
public:
@@ -408,8 +406,6 @@ public:
VDMModelDelegateDataType *dataType,
int index)
: QQmlDMCachedModelData(metaType, dataType, index)
- , row(type->model->rowAt(index))
- , column(type->model->columnAt(index))
{
}
@@ -447,16 +443,6 @@ public:
++scriptRef;
return o.asReturnedValue();
}
-
- void setModelIndex(int idx) override;
-
-Q_SIGNALS:
- void rowChanged();
- void columnChanged();
-
-private:
- int row;
- int column;
};
class VDMAbstractItemModelDataType : public VDMModelDelegateDataType
@@ -577,22 +563,6 @@ public:
}
};
-void QQmlDMAbstractItemModelData::setModelIndex(int idx)
-{
- QQmlDMCachedModelData::setModelIndex(idx);
-
- int prevRow = row;
- int prevColumn = column;
-
- row = type->model->rowAt(idx);
- column = type->model->columnAt(idx);
-
- if (row != prevRow)
- emit rowChanged();
- if (column != prevColumn)
- emit columnChanged();
-}
-
//-----------------------------------------------------------------
// QQmlListAccessor
//-----------------------------------------------------------------