CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
sortmodel.h
Go to the documentation of this file.
1#ifndef SORTMODEL_H
2#define SORTMODEL_H
3
4#include <QSortFilterProxyModel>
5
6class SortModel : public QSortFilterProxyModel {
7 Q_OBJECT
8public:
9 explicit SortModel(QObject* parent = 0);
10
11 void setFilterActive(bool enabled);
12 bool isFilterActive() const;
13 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
14
15protected:
22 bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
23
24private:
25 int updatedSortNdx() const;
26
27 int _currSortNdx;
28 Qt::SortOrder _currSortOrder;
29 bool _filterActive = false;
30};
31#endif
Definition sortmodel.h:6
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Function compares two items while sorting table view.
Definition sortmodel.cpp:14
bool isFilterActive() const
Definition sortmodel.cpp:45
void setFilterActive(bool enabled)
Definition sortmodel.cpp:50
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Definition sortmodel.cpp:55