File indexing completed on 2024-04-21 03:49:29
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2004-2007 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org> 0005 // SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org> 0006 // SPDX-FileCopyrightText: 2010 Bastian Holst <bastianholst@gmx.de> 0007 // SPDX-FileCopyrightText: 2011-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 0008 // SPDX-FileCopyrightText: 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com> 0009 // 0010 0011 #include <QSortFilterProxyModel> 0012 0013 #ifndef MARBLE_CELESTIALSORTFILTERPROXYMODEL_H 0014 #define MARBLE_CELESTIALSORTFILTERPROXYMODEL_H 0015 0016 namespace Marble { 0017 0018 /** 0019 * @brief The CelestialSortFilterProxyModel class is a proxy used by both 0020 * MapViewWidget's listview, and MapChangeEditDialog's listview. 0021 */ 0022 class CelestialSortFilterProxyModel : public QSortFilterProxyModel 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 CelestialSortFilterProxyModel(); 0028 ~CelestialSortFilterProxyModel() override; 0029 /** 0030 * @brief A small trick to change names for dwarfs and moons 0031 */ 0032 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0033 0034 private: 0035 void setupPriorities(); 0036 void setupMoonsList(); 0037 void setupDwarfsList(); 0038 0039 protected: 0040 bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; 0041 0042 private: 0043 QMap<QString, int> m_priority; 0044 QList<QString> m_moons; 0045 QList<QString> m_dwarfs; 0046 }; 0047 } 0048 0049 #endif