diff options
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 90 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p.h | 9 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p_p.h | 3 | ||||
-rw-r--r-- | src/qml/util/qqmladaptormodel.cpp | 6 | ||||
-rw-r--r-- | src/qml/util/qqmladaptormodel_p.h | 2 |
5 files changed, 3 insertions, 107 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 27a84bc2f1..1acd9b982e 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -501,51 +501,6 @@ int QQmlDelegateModel::rows() const return d->m_adaptorModel.rowCount(); } -void QQmlDelegateModelPrivate::setRows(int rows) -{ - Q_Q(QQmlDelegateModel); - const bool changed = m_adaptorModel.rowCount() != rows; - - if (changed || !m_adaptorModel.isValid()) { - const int oldCount = m_count; - - if (rows > 0) - m_adaptorModel.rows = rows; - else - m_adaptorModel.rows.invalidate(); - - // Check if the previous layout was invalidated, and if so, reconnect the model - if (!m_adaptorModel.isValid() && m_adaptorModel.aim()) - m_adaptorModel.setModel(m_adaptorModel.list.list(), q, m_context->engine()); - - if (m_adaptorModel.canFetchMore()) - m_adaptorModel.fetchMore(); - - if (m_complete) { - const int newCount = m_adaptorModel.count(); - if (oldCount) - q->_q_itemsRemoved(0, oldCount); - if (newCount) - q->_q_itemsInserted(0, newCount); - } - - if (changed) - emit q->rowsChanged(); - } -} - -void QQmlDelegateModel::setRows(int rows) -{ - Q_D(QQmlDelegateModel); - d->setRows(rows); -} - -void QQmlDelegateModel::resetRows() -{ - Q_D(QQmlDelegateModel); - d->setRows(-1); -} - /*! \qmlproperty int QtQml.Models::DelegateModel::columns @@ -560,51 +515,6 @@ int QQmlDelegateModel::columns() const return d->m_adaptorModel.columnCount(); } -void QQmlDelegateModelPrivate::setColumns(int columns) -{ - Q_Q(QQmlDelegateModel); - const bool changed = m_adaptorModel.columnCount() != columns; - - if (changed || !m_adaptorModel.isValid()) { - const int oldCount = m_count; - - if (columns > 1) - m_adaptorModel.columns = columns; - else - m_adaptorModel.columns.invalidate(); - - // Check if the previous layout was invalidated, and if so, reconnect the model - if (!m_adaptorModel.isValid() && m_adaptorModel.aim()) - m_adaptorModel.setModel(m_adaptorModel.list.list(), q, m_context->engine()); - - if (m_adaptorModel.canFetchMore()) - m_adaptorModel.fetchMore(); - - if (m_complete) { - const int newCount = m_adaptorModel.count(); - if (oldCount) - q->_q_itemsRemoved(0, oldCount); - if (newCount) - q->_q_itemsInserted(0, newCount); - } - - if (changed) - emit q->columnsChanged(); - } -} - -void QQmlDelegateModel::setColumns(int columns) -{ - Q_D(QQmlDelegateModel); - d->setColumns(columns); -} - -void QQmlDelegateModel::resetColumns() -{ - Q_D(QQmlDelegateModel); - d->setColumns(-1); -} - /*! \qmlmethod QModelIndex QtQml.Models::DelegateModel::modelIndex(int index) diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index 707aaeaa4b..0a76d884ed 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -88,8 +88,8 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public Q_PROPERTY(QQmlListProperty<QQmlDelegateModelGroup> groups READ groups CONSTANT) Q_PROPERTY(QObject *parts READ parts CONSTANT) Q_PROPERTY(QVariant rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged) - Q_PROPERTY(int rows READ rows WRITE setRows RESET resetRows NOTIFY rowsChanged REVISION 12) - Q_PROPERTY(int columns READ columns WRITE setColumns RESET resetColumns NOTIFY columnsChanged REVISION 12) + Q_PROPERTY(int rows READ rows NOTIFY rowsChanged REVISION 12) + Q_PROPERTY(int columns READ columns NOTIFY columnsChanged REVISION 12) Q_CLASSINFO("DefaultProperty", "delegate") Q_INTERFACES(QQmlParserStatus) public: @@ -110,12 +110,7 @@ public: void setRootIndex(const QVariant &root); int rows() const; - void setRows(int rows); - void resetRows(); - int columns() const; - void setColumns(int columns); - void resetColumns(); Q_INVOKABLE QVariant modelIndex(int idx) const; Q_INVOKABLE QVariant parentModelIndex() const; diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 42481be34f..30401a2105 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -303,9 +303,6 @@ public: void incubatorStatusChanged(QQDMIncubationTask *incubationTask, QQmlIncubator::Status status); void setInitialState(QQDMIncubationTask *incubationTask, QObject *o); - void setRows(int rows); - void setColumns(int columns); - QQmlAdaptorModel m_adaptorModel; QQmlListCompositor m_compositor; QQmlComponent *m_delegate; diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index f754e0e1a5..312466e46a 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -1000,7 +1000,7 @@ void QQmlAdaptorModel::invalidateModel(QQmlDelegateModel *vdm) bool QQmlAdaptorModel::isValid() const { - return accessors != &qt_vdm_null_accessors || rows.isValid(); + return accessors != &qt_vdm_null_accessors; } int QQmlAdaptorModel::count() const @@ -1010,15 +1010,11 @@ int QQmlAdaptorModel::count() const int QQmlAdaptorModel::rowCount() const { - if (rows.isValid()) - return rows.value; return qMax(0, accessors->rowCount(*this)); } int QQmlAdaptorModel::columnCount() const { - if (columns.isValid()) - return columns.value; return qMax(isValid() ? 1 : 0, accessors->columnCount(*this)); } diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 82a4ebfcf6..b706fcb5f2 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -106,8 +106,6 @@ public: virtual void fetchMore(QQmlAdaptorModel &) const {} }; - QQmlNullableValue<int> rows; - QQmlNullableValue<int> columns; const Accessors *accessors; QPersistentModelIndex rootIndex; QQmlListAccessor list; |