Plasma
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)));
void append(const T &value)
QMap::const_iterator constBegin() const const
const T value(const Key &key) const const
QQmlEngine * engine() const const
bool isValid() const const
bool contains(const Key &key) const const
filterRegularExpression
DisplayRole
void modelReset()
QStringList keys() const const
void beginRemoveRows(const QModelIndex &parent, int first, int last)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QString fromUtf8(const char *str, int size)
int size() const const
Q_INVOKABLE QVariantMap get(int i) const
Returns the item at index in the list model.
Definition: datamodel.cpp:191
QString sortRole
The role of the sourceModel that will be used for sorting.
Definition: datamodel.h:67
Q_EMITQ_EMIT
void setSourceFilter(const QString &key)
Include only sources that matches this regexp in the model.
Definition: datamodel.cpp:343
const T value(const Key &key, const T &defaultValue) const const
filterKeyColumn
int column() const const
T value() const const
QHash::iterator begin()
int length() const const
AscendingOrder
void clear()
void setFilterRole(int role)
virtual void sort(int column, Qt::SortOrder order) override
QByteArray toLatin1() const const
QString escape(const QString &str)
QString filterRegExp
The regular expression for the filter, only items with their filterRole matching filterRegExp will be...
Definition: datamodel.h:42
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
QString filterString
The string for the filter, only items with their filterRole matching filterString will be displayed.
Definition: datamodel.h:47
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
QString filterRole
The role of the sourceModel on which filterRegExp must be applied.
Definition: datamodel.h:62
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void beginInsertRows(const QModelIndex &parent, int first, int last)
bool toBool() const const
QVector< T > toVector() const const
int remove(const Key &key)
bool isEmpty() const const
void setSortRole(int role)
QVariant data(int role) const const
QQmlContext * contextForObject(const QObject *object)
virtual QHash< int, QByteArray > roleNames() const const
QModelIndex createIndex(int row, int column, void *ptr) const const
Q_INVOKABLE QVariantMap get(int i) const
Returns the item at index in the list model.
Definition: datamodel.cpp:538
QHash::const_iterator constBegin() const const
QHash::const_iterator constEnd() const const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
QMap::const_iterator constEnd() const const
void reserve(int size)
Orientation
bool isEmpty() const const
const Key key(const T &value) const const
bool isEmpty() const const
void beginResetModel()
void endInsertRows()
QRegularExpressionMatch match(const QString &subject, int offset, QRegularExpression::MatchType matchType, QRegularExpression::MatchOptions matchOptions) const const
bool isValid() const const
CaseInsensitiveOption
const Key key(const T &value, const Key &defaultKey) const const
bool strictlyEquals(const QJSValue &other) const const
void setFilterRegularExpression(const QString &pattern)
int row() const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
bool canConvert(int targetTypeId) const const
void invalidateFilter()
QVariant value(const QString &key) const const
void rowsInserted(const QModelIndex &parent, int first, int last)
QJSValue filterCallback
A JavaScript callable that is passed the source model row index as first argument and the value of fi...
Definition: datamodel.h:57
void endRemoveRows()
void rowsRemoved(const QModelIndex &parent, int first, int last)
KCOREADDONS_EXPORT Result match(QStringView pattern, QStringView str)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const const override
void setObjectName(const QString &name)
void sourceModelChanged()
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
bool isCallable() 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
void setKeyRoleFilter(const QString &key)
Include only items with a key that matches this regexp in the model.
Definition: datamodel.cpp:321
QJSValue call(const QJSValueList &args)
QAbstractItemModel sourceModel
The source model of this sorting proxy model.
Definition: datamodel.h:37
void endResetModel()
int count(const Key &key) const const
bool contains(const Key &key) const const
QJSValue toScriptValue(const T &value)
QObject * parent() const const
bool isValid() const const
QHash::iterator end()
bool isNull() const const
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:14:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:14:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.