|
Enroute Flight Navigation
A navigation app for VFR pilots
|
NameFilterProxyModel that orders rows by distance to a reference position. More...
#include <DistanceSortProxyModel.h>
Signals | |
| void | referenceCoordinateChanged () |
| Notification signal for property with the same name. | |
| void | coordinateRoleNameChanged () |
| Notification signal for property with the same name. | |
| void | resortDistanceChanged () |
| Notification signal for property with the same name. | |
| Signals inherited from Ui::NameFilterProxyModel | |
| void | filterChanged () |
| Notification signal for property with the same name. | |
| void | filterRoleNameChanged () |
| Notification signal for property with the same name. | |
Public Member Functions | |
| DistanceSortProxyModel (QObject *parent=nullptr) | |
| Standard constructor. | |
| QGeoCoordinate | referenceCoordinate () const |
| Getter function for the property with the same name. | |
| QString | coordinateRoleName () const |
| Getter function for the property with the same name. | |
| double | resortDistance () const |
| Getter function for the property with the same name. | |
| void | setReferenceCoordinate (const QGeoCoordinate &newReferenceCoordinate) |
| Setter function for the property with the same name. | |
| void | setCoordinateRoleName (const QString &newCoordinateRoleName) |
| Setter function for the property with the same name. | |
| void | setResortDistance (double newResortDistance) |
| Setter function for the property with the same name. | |
| void | setSourceModel (QAbstractItemModel *newSourceModel) override |
| Re-implemented from QAbstractProxyModel. | |
| Public Member Functions inherited from Ui::NameFilterProxyModel | |
| 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. | |
Protected Member Functions | |
| bool | lessThan (const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override |
| Re-implemented from QSortFilterProxyModel. | |
| Protected Member Functions inherited from Ui::NameFilterProxyModel | |
| 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. | |
Properties | |
| QGeoCoordinate | referenceCoordinate |
| Position that distances are measured from. | |
| QString | coordinateRoleName |
| Name of the source model role holding the row's QGeoCoordinate. | |
| double | resortDistance |
| Movement of the reference coordinate, in metres, that triggers a re-sort. | |
| Properties inherited from Ui::NameFilterProxyModel | |
| QString | filter |
| Filter string. | |
| QString | filterRoleName |
| Name of the source model role that the filter is matched against. | |
NameFilterProxyModel that orders rows by distance to a reference position.
This proxy model filters like NameFilterProxyModel and, in addition, orders the accepted rows by distance to the property 'referenceCoordinate', closest first. The distance is computed from the source model role 'coordinateRoleName', which must hold a QGeoCoordinate.
Position feeds update at a high rate. To avoid re-sorting the list on every update, the order is recomputed only when the reference coordinate has moved by more than 'resortDistance' since the last sort. While the reference coordinate is invalid, the order of the source model is kept.
Definition at line 42 of file DistanceSortProxyModel.h.
|
explicit |
Standard constructor.
| parent | The standard QObject parent pointer |
|
inlinenodiscard |
Getter function for the property with the same name.
Definition at line 96 of file DistanceSortProxyModel.h.
|
nodiscardoverrideprotected |
Re-implemented from QSortFilterProxyModel.
| sourceLeft | Index in the source model |
| sourceRight | Index in the source model |
|
inlinenodiscard |
Getter function for the property with the same name.
Definition at line 90 of file DistanceSortProxyModel.h.
|
inlinenodiscard |
Getter function for the property with the same name.
Definition at line 102 of file DistanceSortProxyModel.h.
| void Ui::DistanceSortProxyModel::setCoordinateRoleName | ( | const QString & | newCoordinateRoleName | ) |
Setter function for the property with the same name.
| newCoordinateRoleName | Property coordinateRoleName |
| void Ui::DistanceSortProxyModel::setReferenceCoordinate | ( | const QGeoCoordinate & | newReferenceCoordinate | ) |
Setter function for the property with the same name.
| newReferenceCoordinate | Property referenceCoordinate |
| void Ui::DistanceSortProxyModel::setResortDistance | ( | double | newResortDistance | ) |
Setter function for the property with the same name.
| newResortDistance | Property resortDistance |
|
override |
Re-implemented from QAbstractProxyModel.
Sets the source model and activates sorting.
| newSourceModel | Source model |
|
readwrite |
Name of the source model role holding the row's QGeoCoordinate.
Defaults to "center". Rows keep the source order if the source model has no role of this name.
Definition at line 73 of file DistanceSortProxyModel.h.
|
readwrite |
Position that distances are measured from.
Invalid coordinates are accepted and leave the current order unchanged.
Definition at line 66 of file DistanceSortProxyModel.h.
|
readwrite |
Movement of the reference coordinate, in metres, that triggers a re-sort.
Defaults to 1000 metres.
Definition at line 79 of file DistanceSortProxyModel.h.