Filters a list model by a fuzzy name match.
More...
#include <NameFilterProxyModel.h>
|
|
void | filterChanged () |
| | Notification signal for property with the same name.
|
|
void | filterRoleNameChanged () |
| | Notification signal for property with the same name.
|
|
| | NameFilterProxyModel (QObject *parent=nullptr) |
| | Standard constructor.
|
| QString | filter () const |
| | Getter function for the property with the same name.
|
| QString | filterRoleName () const |
| | Getter function for the property with the same name.
|
| void | setFilter (const QString &newFilter) |
| | Setter function for the property with the same name.
|
| void | setFilterRoleName (const QString &newFilterRoleName) |
| | Setter function for the property with the same name.
|
| void | setSourceModel (QAbstractItemModel *newSourceModel) override |
| | Re-implemented from QAbstractProxyModel.
|
|
| bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
| | Re-implemented from QSortFilterProxyModel.
|
| int | roleForName (const QString &roleName) const |
| | Looks up a role by name in the source model.
|
|
| QString | filter |
| | Filter string.
|
| QString | filterRoleName |
| | Name of the source model role that the filter is matched against.
|
Filters a list model by a fuzzy name match.
This proxy model accepts those rows of its source model whose entry for the role 'filterRoleName' matches the property 'filter', in the sense of Librarian::matches(). The order of the source model is preserved. Typical use in QML:
ListView {
sourceModel: WaypointLibrary
}
}
QString filter
Filter string.
NameFilterProxyModel(QObject *parent=nullptr)
Standard constructor.
Definition at line 60 of file NameFilterProxyModel.h.
◆ NameFilterProxyModel()
| Ui::NameFilterProxyModel::NameFilterProxyModel |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Standard constructor.
- Parameters
-
| parent | The standard QObject parent pointer |
◆ filter()
| QString Ui::NameFilterProxyModel::filter |
( |
| ) |
const |
|
inlinenodiscard |
Getter function for the property with the same name.
- Returns
- Property filter
Definition at line 103 of file NameFilterProxyModel.h.
◆ filterAcceptsRow()
| bool Ui::NameFilterProxyModel::filterAcceptsRow |
( |
int | sourceRow, |
|
|
const QModelIndex & | sourceParent ) const |
|
nodiscardoverrideprotected |
Re-implemented from QSortFilterProxyModel.
- Parameters
-
| sourceRow | Row in the source model |
| sourceParent | Parent index in the source model |
- Returns
- True if the row matches the filter
◆ filterRoleName()
| QString Ui::NameFilterProxyModel::filterRoleName |
( |
| ) |
const |
|
inlinenodiscard |
Getter function for the property with the same name.
- Returns
- Property filterRoleName
Definition at line 109 of file NameFilterProxyModel.h.
◆ roleForName()
| int Ui::NameFilterProxyModel::roleForName |
( |
const QString & | roleName | ) |
const |
|
nodiscardprotected |
Looks up a role by name in the source model.
- Parameters
-
| roleName | Role name, as found in QAbstractItemModel::roleNames() |
- Returns
- The role, or -1 if there is no source model or no role of that name
◆ setFilter()
| void Ui::NameFilterProxyModel::setFilter |
( |
const QString & | newFilter | ) |
|
Setter function for the property with the same name.
- Parameters
-
◆ setFilterRoleName()
| void Ui::NameFilterProxyModel::setFilterRoleName |
( |
const QString & | newFilterRoleName | ) |
|
Setter function for the property with the same name.
- Parameters
-
| newFilterRoleName | Property filterRoleName |
◆ setSourceModel()
| void Ui::NameFilterProxyModel::setSourceModel |
( |
QAbstractItemModel * | newSourceModel | ) |
|
|
override |
Re-implemented from QAbstractProxyModel.
- Parameters
-
| newSourceModel | Source model |
◆ filter
| QString Ui::NameFilterProxyModel::filter |
|
readwrite |
◆ filterRoleName
| QString Ui::NameFilterProxyModel::filterRoleName |
|
readwrite |
Name of the source model role that the filter is matched against.
Defaults to "name". Rows are accepted unconditionally if the source model has no role of this name.
Definition at line 92 of file NameFilterProxyModel.h.
The documentation for this class was generated from the following file: