|
Enroute Flight Navigation
A navigation app for VFR pilots
|
Item model over all waypoints known to the app, for search lists. More...
#include <WaypointSearchModel.h>
Public Types | |
| enum | Role : int { WaypointRole = Qt::UserRole + 1 , NameRole , SearchKeyRole } |
| Model roles. More... | |
Public Member Functions | |
| WaypointSearchModel (QObject *parent=nullptr) | |
| Standard constructor. | |
| int | rowCount (const QModelIndex &parent={}) const override |
| Implementation of QAbstractListModel::rowCount. | |
| QVariant | data (const QModelIndex &index, int role) const override |
| Implementation of QAbstractListModel::data. | |
| QHash< int, QByteArray > | roleNames () const override |
| Implementation of QAbstractListModel::roleNames. | |
Item model over all waypoints known to the app, for search lists.
Rows are the waypoints of the WaypointLibrary (the user's own waypoints, first), followed by the waypoints of the installed aviation maps. Both groups are sorted by name. Library changes are forwarded row by row; a change of the aviation data replaces the map rows in a single reset.
The role 'searchKey' holds Librarian::simplify(name) + " " + Librarian::simplify(ICAO code). For the map rows it is precomputed on the worker thread that reads the aviation data, so that a NameFilterProxyModel with filterRoleIsSimplified can filter tens of thousands of rows on every keystroke without normalising a single name:
model: NameFilterProxyModel { sourceModel: WaypointSearchModel {} filterRoleName: "searchKey" filterRoleIsSimplified: true filter: textInput.filter }
Definition at line 51 of file WaypointSearchModel.h.
| enum Ui::WaypointSearchModel::Role : int |
Model roles.
| Enumerator | |
|---|---|
| WaypointRole | The waypoint, of type GeoMaps::Waypoint. |
| NameRole | Name of the waypoint, a QString. |
| SearchKeyRole | Pre-simplified search key, a QString. |
Definition at line 58 of file WaypointSearchModel.h.
|
explicit |
Standard constructor.
| parent | The standard QObject parent pointer |
|
nodiscardoverride |
|
nodiscardoverride |
Implementation of QAbstractListModel::roleNames.
|
nodiscardoverride |
Implementation of QAbstractListModel::rowCount.
| parent | Parent index, ignored for a list |