File indexing completed on 2024-05-12 05:06:16
0001 /* 0002 SPDX-FileCopyrightText: 2023 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef LEDGERSORTORDER_H 0007 #define LEDGERSORTORDER_H 0008 0009 #include "kmm_models_export.h" 0010 0011 // ---------------------------------------------------------------------------- 0012 // QT Includes 0013 0014 #include <QList> 0015 0016 // ---------------------------------------------------------------------------- 0017 // KDE Includes 0018 0019 // ---------------------------------------------------------------------------- 0020 // Project Includes 0021 0022 class KMM_MODELS_EXPORT ColumnSortItem 0023 { 0024 public: 0025 int sortRole; 0026 Qt::SortOrder sortOrder; 0027 0028 inline bool operator==(const ColumnSortItem& right) const 0029 { 0030 return (sortRole == right.sortRole) && (sortOrder == right.sortOrder); 0031 } 0032 0033 inline bool operator!=(const ColumnSortItem& right) const 0034 { 0035 return (sortRole != right.sortRole) || (sortOrder != right.sortOrder); 0036 } 0037 0038 inline bool lessThanIs(bool result) const 0039 { 0040 return (sortOrder == Qt::AscendingOrder) ? result : !result; 0041 } 0042 }; 0043 0044 class KMM_MODELS_EXPORT LedgerSortOrder : public QList<ColumnSortItem> 0045 { 0046 public: 0047 LedgerSortOrder(); 0048 explicit LedgerSortOrder(const QString& sortOrder); 0049 void setSortOrder(const QString& sortOrder); 0050 }; 0051 0052 #endif // LEDGERSORTORDER_H