The pqProxyCategory class reads and writes XML that describes the proxies organisation into categories. More...
#include <pqProxyCategory.h>
Inherits QObject.
Public Member Functions | |
pqProxyCategory (pqProxyCategory *parent=nullptr) | |
pqProxyCategory (pqProxyCategory *parent, const QString &name, const QString &label) | |
~pqProxyCategory () override | |
void | writeSettings (const QString &resourceTag) |
Settings methods. More... | |
void | loadSettings (const QString &resourceTag) |
Load categories from ParaView settings. More... | |
void | copyAttributes (pqProxyCategory *other) |
Copy methods. More... | |
void | deepCopy (pqProxyCategory *other) |
Deep copy category. More... | |
bool | hasProxy (const QString &name) |
Contained proxies. More... | |
pqProxyInfo * | findProxy (const QString &name, bool recursive=false) |
Return child proxy from name. More... | |
QList< pqProxyInfo * > | getRootProxies () |
Return direct child proxies. More... | |
QList< pqProxyInfo * > | getProxiesRecursive () |
Return proxies including subcategories proxies. More... | |
QStringList | getOrderedRootProxiesNames () |
Return direct child proxies names, preserving the declaration order. More... | |
pqProxyCategory * | findSubCategory (const QString &name) |
Contained categories. More... | |
QMap< QString, pqProxyCategory * > | getSubCategories () |
Return contained categories. More... | |
QMap< QString, pqProxyCategory * > | getSubCategoriesRecursive () |
Return contained categories recursively. More... | |
QList< pqProxyCategory * > | getCategoriesAlphabetically () |
Return categories by alphabetical name order (case insensitive). More... | |
QString | makeUniqueCategoryName (const QString &name) |
Make "name" unique in category child list by appending a numeric value. More... | |
QString | makeUniqueCategoryLabel (const QString &label) |
Make "label" unique in category child list by appending a numeric value. More... | |
void | addCategory (pqProxyCategory *category) |
Category children modifiers. More... | |
void | removeCategory (const QString &name) |
remove child category More... | |
void | addProxy (pqProxyInfo *info) |
add a child proxy More... | |
void | removeProxy (const QString &name) |
remove child proxy More... | |
void | clear () |
Remove children categories and proxies. More... | |
bool | hasProxiesRecursive () |
Get properties. More... | |
pqProxyCategory * | parentCategory () |
Return parent category. More... | |
bool | isEmpty () |
Returns true if there is no subcategories and no proxies. More... | |
QString | name () |
Return category name. More... | |
QString | label () |
Return category label. More... | |
bool | preserveOrder () |
Return true if read order should be used in display. More... | |
bool | showInToolbar () |
Return true if a toolbar should be created. More... | |
void | rename (const QString &name) |
Set properties. More... | |
void | updateLabel (const QString &label="") |
Create label from name if empty. More... | |
void | setShowInToolbar (bool show) |
If true, a toolbar will be generated for this category. Default is false. More... | |
Protected Slots | |
void | cleanDeletedProxy (QObject *deleted) |
Protected Member Functions | |
pqProxyCategory * | addCategory (const QString &name, vtkPVXMLElement *node) |
Add a category from the xml node. More... | |
bool | parseXML (vtkPVXMLElement *root) |
XML Parsing methods. More... | |
void | convertToXML (vtkPVXMLElement *root) |
Add Proxies and SubCategories XML declaration to root element. More... | |
bool | parseXMLHintsTag (const QString &proxyGroup, const QString &proxyName, vtkPVXMLElement *hints) |
Parse <Hints> tag and look for <ShowInMenu> children to create proxy and category information. More... | |
static void | convertLegacyXML (vtkPVXMLElement *root) |
Modify the vtkPVXMLElement for backward compatibility. More... | |
The pqProxyCategory class reads and writes XML that describes the proxies organisation into categories.
Categories can be nested and are describe in XML files, like this example:
Proxies can have properties, like icon:
The xml hints <ShowInMenu>
can also be used at proxy definition to assign it in a category. This was mainly designed for plugins, but those also support the ParaViewFilters
syntax, so this hints will most likely be deprecated at some point.
Definition at line 60 of file pqProxyCategory.h.
pqProxyCategory::pqProxyCategory | ( | pqProxyCategory * | parent = nullptr | ) |
pqProxyCategory::pqProxyCategory | ( | pqProxyCategory * | parent, |
const QString & | name, | ||
const QString & | label | ||
) |
|
override |
bool pqProxyCategory::parseXML | ( | vtkPVXMLElement * | root | ) |
XML Parsing methods.
Parse XML node to create children categories and proxies. Return true if modified.
|
inline |
Add Proxies and SubCategories XML declaration to root element.
Definition at line 77 of file pqProxyCategory.h.
bool pqProxyCategory::parseXMLHintsTag | ( | const QString & | proxyGroup, |
const QString & | proxyName, | ||
vtkPVXMLElement * | hints | ||
) |
Parse <Hints>
tag and look for <ShowInMenu>
children to create proxy and category information.
Example of expected xml:
Search recursively for relevant category under "root" and create it if needed. This is mainly for plugins. Note that plugins also support <ParaViewFilters>
tag. Returns true if category was modified.
|
static |
Modify the vtkPVXMLElement for backward compatibility.
void pqProxyCategory::writeSettings | ( | const QString & | resourceTag | ) |
Settings methods.
Write categories into ParaView settings.
void pqProxyCategory::loadSettings | ( | const QString & | resourceTag | ) |
Load categories from ParaView settings.
void pqProxyCategory::copyAttributes | ( | pqProxyCategory * | other | ) |
Copy methods.
Copy only the attributes from given category. Proxy list and subcategories are untouched.
void pqProxyCategory::deepCopy | ( | pqProxyCategory * | other | ) |
Deep copy category.
bool pqProxyCategory::hasProxy | ( | const QString & | name | ) |
Contained proxies.
Return true if a direct child exists with the given name.
pqProxyInfo* pqProxyCategory::findProxy | ( | const QString & | name, |
bool | recursive = false |
||
) |
Return child proxy from name.
If recursive is true, forward request to subcategories until finding a matching proxy.
QList<pqProxyInfo*> pqProxyCategory::getRootProxies | ( | ) |
Return direct child proxies.
QList<pqProxyInfo*> pqProxyCategory::getProxiesRecursive | ( | ) |
Return proxies including subcategories proxies.
QStringList pqProxyCategory::getOrderedRootProxiesNames | ( | ) |
Return direct child proxies names, preserving the declaration order.
pqProxyCategory* pqProxyCategory::findSubCategory | ( | const QString & | name | ) |
Contained categories.
Return contained category by name. If not found, return an empty one.
QMap<QString, pqProxyCategory*> pqProxyCategory::getSubCategories | ( | ) |
Return contained categories.
QMap<QString, pqProxyCategory*> pqProxyCategory::getSubCategoriesRecursive | ( | ) |
Return contained categories recursively.
QList<pqProxyCategory*> pqProxyCategory::getCategoriesAlphabetically | ( | ) |
Return categories by alphabetical name order (case insensitive).
QString pqProxyCategory::makeUniqueCategoryName | ( | const QString & | name | ) |
Make "name" unique in category child list by appending a numeric value.
QString pqProxyCategory::makeUniqueCategoryLabel | ( | const QString & | label | ) |
Make "label" unique in category child list by appending a numeric value.
void pqProxyCategory::addCategory | ( | pqProxyCategory * | category | ) |
Category children modifiers.
Set given category as a subcategory. Will replace any subcategory with same name.
void pqProxyCategory::removeCategory | ( | const QString & | name | ) |
remove child category
void pqProxyCategory::addProxy | ( | pqProxyInfo * | info | ) |
add a child proxy
void pqProxyCategory::removeProxy | ( | const QString & | name | ) |
remove child proxy
void pqProxyCategory::clear | ( | ) |
Remove children categories and proxies.
bool pqProxyCategory::hasProxiesRecursive | ( | ) |
Get properties.
Return true if it has a direct child proxy or any subcategory has a proxy.
|
inline |
Return parent category.
Definition at line 181 of file pqProxyCategory.h.
bool pqProxyCategory::isEmpty | ( | ) |
Returns true if there is no subcategories and no proxies.
|
inline |
Return category name.
Definition at line 185 of file pqProxyCategory.h.
QString pqProxyCategory::label | ( | ) |
Return category label.
|
inline |
Return true if read order should be used in display.
Definition at line 189 of file pqProxyCategory.h.
|
inline |
Return true if a toolbar should be created.
Definition at line 191 of file pqProxyCategory.h.
void pqProxyCategory::rename | ( | const QString & | name | ) |
Set properties.
Set category name. This also update parent cache.
void pqProxyCategory::updateLabel | ( | const QString & | label = "" | ) |
Create label from name if empty.
void pqProxyCategory::setShowInToolbar | ( | bool | show | ) |
If true, a toolbar will be generated for this category. Default is false.
|
protected |
Add a category from the xml node.
If a category already exists for given name, return it instead.
|
protectedslot |