diff options
Diffstat (limited to 'src/qmlmodels')
-rw-r--r-- | src/qmlmodels/qqmldelegatemodel.cpp | 8 | ||||
-rw-r--r-- | src/qmlmodels/qqmldelegatemodel_p_p.h | 2 | ||||
-rw-r--r-- | src/qmlmodels/qqmltableinstancemodel.cpp | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index 65c99d9bc0..24632fe16b 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -2123,7 +2123,7 @@ void QQmlDelegateModelItem::Dispose() delete this; } -void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn) +void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn, bool alwaysEmit) { const int prevIndex = index; const int prevRow = row; @@ -2133,11 +2133,11 @@ void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn) row = newRow; column = newColumn; - if (idx != prevIndex) + if (idx != prevIndex || alwaysEmit) emit modelIndexChanged(); - if (row != prevRow) + if (row != prevRow || alwaysEmit) emit rowChanged(); - if (column != prevColumn) + if (column != prevColumn || alwaysEmit) emit columnChanged(); } diff --git a/src/qmlmodels/qqmldelegatemodel_p_p.h b/src/qmlmodels/qqmldelegatemodel_p_p.h index 92362b8876..3c8af5ca43 100644 --- a/src/qmlmodels/qqmldelegatemodel_p_p.h +++ b/src/qmlmodels/qqmldelegatemodel_p_p.h @@ -129,7 +129,7 @@ public: int modelRow() const { return row; } int modelColumn() const { return column; } int modelIndex() const { return index; } - virtual void setModelIndex(int idx, int newRow, int newColumn); + virtual void setModelIndex(int idx, int newRow, int newColumn, bool alwaysEmit = false); virtual QV4::ReturnedValue get() { return QV4::QObjectWrapper::wrap(v4, this); } diff --git a/src/qmlmodels/qqmltableinstancemodel.cpp b/src/qmlmodels/qqmltableinstancemodel.cpp index b244a007e5..fb2f7ee98b 100644 --- a/src/qmlmodels/qqmltableinstancemodel.cpp +++ b/src/qmlmodels/qqmltableinstancemodel.cpp @@ -342,9 +342,13 @@ void QQmlTableInstanceModel::reuseItem(QQmlDelegateModelItem *item, int newModel { // Update the context properties index, row and column on // the delegate item, and inform the application about it. + // Note that we set alwaysEmit to true, to force all bindings + // to be reevaluated, even if the index didn't change (since + // the model can have changed size since last usage). + const bool alwaysEmit = true; const int newRow = m_adaptorModel.rowAt(newModelIndex); const int newColumn = m_adaptorModel.columnAt(newModelIndex); - item->setModelIndex(newModelIndex, newRow, newColumn); + item->setModelIndex(newModelIndex, newRow, newColumn, alwaysEmit); // Notify the application that all 'dynamic'/role-based context data has // changed as well (their getter function will use the updated index). |