pqPresetGroupsManager.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqPresetGroupsManager_h
6 #define pqPresetGroupsManager_h
7 
8 #include "pqComponentsModule.h" // for exports
9 
10 #include <QList>
11 #include <QMap>
12 #include <QObject>
13 
63 class PQCOMPONENTS_EXPORT pqPresetGroupsManager : public QObject
64 {
65  Q_OBJECT
66  typedef QObject Superclass;
67 
68 public:
73  pqPresetGroupsManager(QObject* p);
74  ~pqPresetGroupsManager() override;
75 
79  int numberOfGroups();
83  int numberOfPresetsInGroup(const QString& groupName);
84 
88  QList<QString> presetsInGroup(const QString& groupName);
89 
94  int presetRankInGroup(const QString& presetName, const QString& groupName);
98  QList<QString> groupNames();
102  QString groupName(int i);
103 
111  void loadGroups(const QString& json);
112 
118  void replaceGroups(const QString& json);
119 
124  bool loadGroupsFromSettings();
125 
130  void addToGroup(const QString& groupName, const QString& presetName);
131 
135  void removeFromGroup(const QString& groupName, const QString& presetName);
136 
140  void removeFromAllGroups(const QString& presetName);
141 
142  /*
143  * Get preset groups
144  */
145  static QString getPresetGroupsJson();
146 
147 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
151  void saveGroupsToSettings();
152 
153 Q_SIGNALS:
158  void groupsUpdated();
159 
160 private:
161  QList<QString> GroupNames;
162  QMap<QString, QList<QString>> Groups;
163 
170  void clearGroups();
171 };
172 
173 #endif
pqPresetGroupsManager is an object to manage the groups of color map presets displayed in the pqPrese...