Plasma5Support
datamodel.cpp
68 disconnect(sourceModel(), &QAbstractItemModel::modelReset, this, &SortFilterModel::syncRoleNames);
102 QSortFilterProxyModel::setFilterRegularExpression(QRegularExpression(exp, QRegularExpression::CaseInsensitiveOption));
117 QSortFilterProxyModel::setFilterRegularExpression(QRegularExpression{QRegularExpression::escape(filterString), QRegularExpression::CaseInsensitiveOption});
248 if (!m_sourceFilter.isEmpty() && m_sourceFilterRE.isValid() && !isExactMatch(m_sourceFilterRE, sourceName)) {
259 if (!m_sourceFilter.isEmpty() && m_sourceFilterRE.isValid() && !isExactMatch(m_sourceFilterRE, key)) {
381 // better than a model reset because doesn't cause deletion and re-creation of every list item on a qml ListView, repeaters etc.
416 Q_EMIT dataChanged(createIndex(sourceIndex, 0), createIndex(sourceIndex + qMin(list.length(), oldLength), 0));
431 if (m_items.value(QString())[i].value<QVariantMap>().value(QStringLiteral("DataEngineSource")) == sourceName) {
485 // also, if each source is an item DataEngineSource is a role between all the others, otherwise we know it from the role variable
489 return m_items.value(source).value(actualRow).value<QVariantMap>().value(QString::fromUtf8(m_roleNames.value(role)));
QML_ELEMENTQObject * dataSource
The instance of DataSource to construct this model on.
Definition datamodel.h:167
void setKeyRoleFilter(const QString &key)
Include only items with a key that matches this regexp in the model.
Definition datamodel.cpp:321
void setSourceFilter(const QString &key)
Include only sources that matches this regexp in the model.
Definition datamodel.cpp:343
Q_INVOKABLE QVariantMap get(int i) const
Returns the item at index in the list model.
Definition datamodel.cpp:538
Filter and sort an existing QAbstractItemModel.
Definition datamodel.h:33
QML_ELEMENTQAbstractItemModel * sourceModel
The source model of this sorting proxy model.
Definition datamodel.h:39
Q_INVOKABLE QVariantMap get(int i) const
Returns the item at index in the list model.
Definition datamodel.cpp:191
QString filterRole
The role of the sourceModel on which filterRegExp must be applied.
Definition datamodel.h:64
QString filterRegExp
The regular expression for the filter, only items with their filterRole matching filterRegExp will be...
Definition datamodel.h:44
QJSValue filterCallback
A JavaScript callable that is passed the source model row index as first argument and the value of fi...
Definition datamodel.h:59
QString filterString
The string for the filter, only items with their filterRole matching filterString will be displayed.
Definition datamodel.h:49
KCOREADDONS_EXPORT Result match(QStringView pattern, QStringView str)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
void beginInsertRows(const QModelIndex &parent, int first, int last)
void beginRemoveRows(const QModelIndex &parent, int first, int last)
void beginResetModel()
QModelIndex createIndex(int row, int column, const void *ptr) const const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
void endInsertRows()
void endRemoveRows()
void endResetModel()
void modelReset()
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
void sourceModelChanged()
iterator begin()
void clear()
const_iterator constBegin() const const
const_iterator constEnd() const const
bool contains(const Key &key) const const
qsizetype count() const const
iterator end()
Key key(const T &value) const const
void reserve(qsizetype size)
T value(const Key &key) const const
QJSValue toScriptValue(const T &value)
QJSValue call(const QJSValueList &args) const const
bool isCallable() const const
bool isNull() const const
bool strictlyEquals(const QJSValue &other) const const
bool toBool() const const
QList< T > toVector() const const
void append(QList< T > &&value)
bool isEmpty() const const
qsizetype length() const const
const_iterator constBegin() const const
const_iterator constEnd() const const
bool contains(const Key &key) const const
bool isEmpty() const const
Key key(const T &value, const Key &defaultKey) const const
size_type remove(const Key &key)
T value(const Key &key, const T &defaultValue) const const
int column() const const
QVariant data(int role) const const
bool isValid() const const
int row() const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QObject * parent() const const
T qobject_cast(QObject *object)
void setObjectName(QAnyStringView name)
QQmlEngine * engine() const const
QQmlContext * contextForObject(const QObject *object)
bool isEmpty() const const
QStringList keys() const const
QVariant value(const QString &key) const const
QRegularExpressionMatch match(QStringView subjectView, qsizetype offset, MatchType matchType, MatchOptions matchOptions) const const
CaseInsensitiveOption
QString escape(QStringView str)
bool isValid() const const
virtual QVariant data(const QModelIndex &index, int role) const const override
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
filterKeyColumn
void setFilterRegularExpression(const QRegularExpression ®ularExpression)
void setFilterRole(int role)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
void invalidateFilter()
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const const override
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
virtual void sort(int column, Qt::SortOrder order) override
void setSortRole(int role)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
qsizetype size() const const
QByteArray toLatin1() const const
DisplayRole
Orientation
AscendingOrder
DataSource
bool canConvert() const const
bool isValid() const const
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.