Warning, file /plasma/plasma-workspace/kcms/colors/colorsmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2007 Jeremy Whiting <jpwhiting@kde.org> 0004 SPDX-FileCopyrightText: 2016 Olivier Churlaud <olivier@churlaud.com> 0005 SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@privat.broulik.de> 0006 0007 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0008 */ 0009 0010 #pragma once 0011 0012 #include <QAbstractListModel> 0013 #include <QList> 0014 #include <QPalette> 0015 #include <QString> 0016 0017 struct ColorsModelData { 0018 QString display; 0019 QString schemeName; 0020 QPalette palette; 0021 QPalette selectedPalette; 0022 QColor activeTitleBarBackground; 0023 QColor activeTitleBarForeground; 0024 bool removable; 0025 bool accentActiveTitlebar; 0026 bool pendingDeletion; 0027 bool tints; 0028 qreal tintFactor; 0029 }; 0030 Q_DECLARE_TYPEINFO(ColorsModelData, Q_RELOCATABLE_TYPE); 0031 0032 class ColorsModel : public QAbstractListModel 0033 { 0034 Q_OBJECT 0035 0036 Q_PROPERTY(QString selectedScheme READ selectedScheme WRITE setSelectedScheme NOTIFY selectedSchemeChanged) 0037 Q_PROPERTY(int selectedSchemeIndex READ selectedSchemeIndex NOTIFY selectedSchemeIndexChanged) 0038 0039 public: 0040 ColorsModel(QObject *parent); 0041 ~ColorsModel() override; 0042 0043 enum Roles { 0044 SchemeNameRole = Qt::UserRole + 1, 0045 PaletteRole, 0046 SelectedPaletteRole, 0047 // Colors which aren't in QPalette 0048 ActiveTitleBarBackgroundRole, 0049 ActiveTitleBarForegroundRole, 0050 DisabledText, 0051 RemovableRole, 0052 AccentActiveTitlebarRole, 0053 PendingDeletionRole, 0054 Tints, 0055 TintFactor, 0056 }; 0057 0058 int rowCount(const QModelIndex &parent) const override; 0059 QVariant data(const QModelIndex &index, int role) const override; 0060 bool setData(const QModelIndex &index, const QVariant &value, int role) override; 0061 QHash<int, QByteArray> roleNames() const override; 0062 0063 QString selectedScheme() const; 0064 void setSelectedScheme(const QString &scheme); 0065 0066 int indexOfScheme(const QString &scheme) const; 0067 int selectedSchemeIndex() const; 0068 0069 QStringList pendingDeletions() const; 0070 void removeItemsPendingDeletion(); 0071 0072 void load(); 0073 0074 Q_SIGNALS: 0075 void selectedSchemeChanged(const QString &scheme); 0076 void selectedSchemeIndexChanged(); 0077 0078 void pendingDeletionsChanged(); 0079 0080 private: 0081 QString m_selectedScheme; 0082 0083 QList<ColorsModelData> m_data; 0084 };