VR-Engage  2.3
Loading...
Searching...
No Matches
vreStationSortProxyModel.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2026 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreStationSortProxyModel.h
7//! \ingroup vreManager
8//! \brief Two-key sort proxy model for the VR-Engage station list
9
10#pragma once
11
12#include "vreManager/export.h"
13
14#include <QSortFilterProxyModel>
15
16namespace makVre
17{
18
19//! \brief Sort mode for the station list proxy
21{
22 ByStatus, //!< Primary: status priority; secondary: station name alpha
23 ByStationName //!< Primary: station name alpha; secondary: status priority
24};
25
26//! \brief Two-key sort proxy for the VR-Engage station list
27//!
28//! Supports two independently toggleable primary sort modes:
29//! - ByStatus: sorts [conflict, pending assign, pending unassign, assigned, unassigned],
30//! then alphabetically within each group.
31//! - ByStationName: sorts alphabetically by station name (case-insensitive),
32//! then by status priority as the fallback.
33//!
34//! Call setSortMode() to switch between modes and setAscending() to toggle direction.
35class VREMANAGER_DLL DtVreStationSortProxyModel : public QSortFilterProxyModel
36{
37 Q_OBJECT
38
39public:
40 explicit DtVreStationSortProxyModel(QObject* parent = nullptr);
41 virtual ~DtVreStationSortProxyModel() override;
42
43 //! \brief Applies the current sort mode and direction explicitly
45
46 //! \brief Sets the primary sort mode and re-sorts immediately
48
49 //! \brief Returns the current sort mode
51
52 //! \brief Sets the sort direction for the current mode and re-sorts immediately
54
55 //! \brief Returns true if sorting ascending
56 bool ascending() const;
57
58 //! \brief Ignores generic sort requests so re-sorting stays explicit
59 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
60
61protected:
62 bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
63
64private:
66 bool myAscending = true;
67};
68
69} // namespace makVre
StationSortMode myMode
Definition vreStationSortProxyModel.h:65
void setAscending(bool ascending)
Sets the sort direction for the current mode and re-sorts immediately.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
DtVreStationSortProxyModel(QObject *parent=nullptr)
void setSortMode(StationSortMode mode)
Sets the primary sort mode and re-sorts immediately.
virtual ~DtVreStationSortProxyModel() override
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Ignores generic sort requests so re-sorting stays explicit.
bool myAscending
Definition vreStationSortProxyModel.h:66
void applyCurrentSort()
Applies the current sort mode and direction explicitly.
StationSortMode sortMode() const
Returns the current sort mode.
bool ascending() const
Returns true if sorting ascending.
Export macros for the VREngage Manager library.
#define VREMANAGER_DLL
Platform-specific export/import macro for VREngage Manager library.
Definition export.h:28
!
Definition glsVreMessageUtil.h:50
StationSortMode
Sort mode for the station list proxy.
Definition vreStationSortProxyModel.h:21
@ ByStationName
Primary: station name alpha; secondary: status priority.
Definition vreStationSortProxyModel.h:23
@ ByStatus
Primary: status priority; secondary: station name alpha.
Definition vreStationSortProxyModel.h:22