diff --git a/qqmlsortfilterproxymodel.cpp b/qqmlsortfilterproxymodel.cpp index c0912f1..d13efdf 100644 --- a/qqmlsortfilterproxymodel.cpp +++ b/qqmlsortfilterproxymodel.cpp @@ -52,30 +52,6 @@ int QQmlSortFilterProxyModel::count() const return rowCount(); } -/*! - \qmlproperty int SortFilterProxyModel::limit - - Limit the total number of results -*/ -int QQmlSortFilterProxyModel::limit() const -{ - return m_limit; -} - -void QQmlSortFilterProxyModel::setLimit(int newLimit) -{ - if (m_limit == newLimit) - return; - - const auto prevCount = count(); - m_limit = newLimit; - emit limitChanged(); - - if (prevCount != count()) { - emit countChanged(); - } -} - /*! \qmlproperty bool SortFilterProxyModel::delayed @@ -258,14 +234,6 @@ QVariant QQmlSortFilterProxyModel::sourceData(const QModelIndex &sourceIndex, in return sourceModel()->data(sourceIndex, role); } -int QQmlSortFilterProxyModel::rowCount(const QModelIndex& parent) const -{ - const auto origLimit = QSortFilterProxyModel::rowCount(parent); - if (m_limit == -1) - return origLimit; - return qMin(m_limit, origLimit); -} - QVariant QQmlSortFilterProxyModel::data(const QModelIndex &index, int role) const { return sourceData(mapToSource(index), role); diff --git a/qqmlsortfilterproxymodel.h b/qqmlsortfilterproxymodel.h index d45274e..dbe0229 100644 --- a/qqmlsortfilterproxymodel.h +++ b/qqmlsortfilterproxymodel.h @@ -23,7 +23,6 @@ class QQmlSortFilterProxyModel : public QSortFilterProxyModel, Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(bool delayed READ delayed WRITE setDelayed NOTIFY delayedChanged) - Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged FINAL) Q_PROPERTY(QString filterRoleName READ filterRoleName WRITE setFilterRoleName NOTIFY filterRoleNameChanged) Q_PROPERTY(QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged) @@ -94,7 +93,6 @@ public: void setSourceModel(QAbstractItemModel *sourceModel) override; Q_SIGNALS: - void limitChanged(); void countChanged(); void delayedChanged(); @@ -107,7 +105,6 @@ Q_SIGNALS: void ascendingSortOrderChanged(); protected: - int rowCount(const QModelIndex &parent = QModelIndex()) const override; bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override; @@ -129,9 +126,6 @@ private Q_SLOTS: void invalidateProxyRoles(); private: - int limit() const; - void setLimit(int newLimit); - QVariantMap modelDataMap(const QModelIndex& modelIndex) const; void onFilterAppended(Filter* filter) override; @@ -159,7 +153,6 @@ private: bool m_invalidateFilterQueued = false; bool m_invalidateQueued = false; bool m_invalidateProxyRolesQueued = false; - int m_limit{-1}; }; }