pqPresetGroupsManager is an object to manage the groups of color map presets displayed in the pqPresetDialog. More...
#include <pqPresetGroupsManager.h>
Inherits QObject.
Public Slots | |
void | saveGroupsToSettings () |
Save groups to settings. More... | |
Signals | |
void | groupsUpdated () |
Fired whenever loadGroups or replaceGroups is called and new group information is available. More... | |
Public Member Functions | |
pqPresetGroupsManager (QObject *p) | |
Create a new groups manager. More... | |
~pqPresetGroupsManager () override | |
int | numberOfGroups () |
Returns the number of groups the manager knows of. More... | |
int | numberOfPresetsInGroup (const QString &groupName) |
Returns the number of presets in the given group. More... | |
int | presetRankInGroup (const QString &presetName, const QString &groupName) |
Returns the rank (index) of the given preset in the given group. More... | |
QList< QString > | groupNames () |
Returns a list of the group names the manager knows of. More... | |
QString | groupName (int i) |
Returns the name of the ith group in the manager's list of groups. More... | |
void | loadGroups (const QString &json) |
Load groups from the given JSON string (for the format see the class documentation) and add the groups to the groups in the manager. More... | |
void | replaceGroups (const QString &json) |
Clears all groups in the manager and then loads groups from the given JSON string (see loadGroups). More... | |
bool | loadGroupsFromSettings () |
Load the groups from the settings Return true if loading was successful. More... | |
void | addToGroup (const QString &groupName, const QString &presetName) |
Adds a preset to a group. More... | |
void | removeFromGroup (const QString &groupName, const QString &presetName) |
Removes a preset from a group. More... | |
void | removeFromAllGroups (const QString &presetName) |
Removes a preset from all groups. More... | |
Static Public Member Functions | |
static QString | getPresetGroupsJson () |
pqPresetGroupsManager is an object to manage the groups of color map presets displayed in the pqPresetDialog.
A pqPresetGroupsManager is created by the pqPVApplicationCore and registered as a manager. To get it:
The group manager loads the groups of presets from a json file with this format:
Definition at line 63 of file pqPresetGroupsManager.h.
pqPresetGroupsManager::pqPresetGroupsManager | ( | QObject * | p | ) |
Create a new groups manager.
Custom applications should use the one created by pqPVApplicationCore (see class description).
|
override |
int pqPresetGroupsManager::numberOfGroups | ( | ) |
Returns the number of groups the manager knows of.
Returns the number of presets in the given group.
int pqPresetGroupsManager::presetRankInGroup | ( | const QString & | presetName, |
const QString & | groupName | ||
) |
Returns the rank (index) of the given preset in the given group.
Returns -1 if the preset is not in the group (the preset dialog relies on this).
QList<QString> pqPresetGroupsManager::groupNames | ( | ) |
Returns a list of the group names the manager knows of.
QString pqPresetGroupsManager::groupName | ( | int | i | ) |
Returns the name of the ith group in the manager's list of groups.
void pqPresetGroupsManager::loadGroups | ( | const QString & | json | ) |
Load groups from the given JSON string (for the format see the class documentation) and add the groups to the groups in the manager.
This is an append operation so the groups already in the manager will not be removed. If the json string has a group with the same name as one already in the manager, then the color maps in that group will be appended to the existing group.
void pqPresetGroupsManager::replaceGroups | ( | const QString & | json | ) |
Clears all groups in the manager and then loads groups from the given JSON string (see loadGroups).
This is an override operation instead of the append provided by loadGroups.
bool pqPresetGroupsManager::loadGroupsFromSettings | ( | ) |
Load the groups from the settings Return true if loading was successful.
Adds a preset to a group.
Creates the group if it does not exist
void pqPresetGroupsManager::removeFromGroup | ( | const QString & | groupName, |
const QString & | presetName | ||
) |
Removes a preset from a group.
void pqPresetGroupsManager::removeFromAllGroups | ( | const QString & | presetName | ) |
Removes a preset from all groups.
|
static |
|
slot |
Save groups to settings.
|
signal |
Fired whenever loadGroups or replaceGroups is called and new group information is available.