Public Member Functions | Protected Slots | Protected Member Functions | List of all members
pqProxyCategory Class Reference

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...
 
pqProxyInfofindProxy (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...
 
pqProxyCategoryfindSubCategory (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...
 
pqProxyCategoryparentCategory ()
 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

pqProxyCategoryaddCategory (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...
 

Detailed Description

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:

<ParaViewFilters>
<Category name="DataModel" menu_label="Data Model" show_in_toolbar="0">
<Category name="Hyper Tree Grid" menu_label="&amp;Hyper Tree Grid">
<Proxy group="filters" name="Clip" />
<Proxy group="filters" name="Cut" />
</Category>
<Category name="Chemistry" menu_label="Chemistry">
<Proxy group="filters" name="AppendMolecule" />
<Proxy group="filters" name="ComputeMoleculeBonds" />
<Proxy group="filters" name="MoleculeToLines" />
<Proxy group="filters" name="PointSetToMolecule" />
</Category>
</Category>
<Category name="Statistics" menu_label="&amp;Statistics">
<Proxy group="filters" name="ContingencyStatistics" />
<Proxy group="filters" name="DescriptiveStatistics" />
</Category>
</ParaViewFilters>

Proxies can have properties, like icon:

<ParaViewFilters>
<Proxy group="filters" name="Clip" icon=":/pqWidgets/Icons/pqClip.svg" />
</ParaViewFilters>

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.

<Proxy name="MyFilter">
...
<Hints>
<ShowInMenu category="SomeCategory" icon="path/to/icon" />
</Hints>
</Proxy>

Definition at line 60 of file pqProxyCategory.h.

Constructor & Destructor Documentation

◆ pqProxyCategory() [1/2]

pqProxyCategory::pqProxyCategory ( pqProxyCategory parent = nullptr)

◆ pqProxyCategory() [2/2]

pqProxyCategory::pqProxyCategory ( pqProxyCategory parent,
const QString &  name,
const QString &  label 
)

◆ ~pqProxyCategory()

pqProxyCategory::~pqProxyCategory ( )
override

Member Function Documentation

◆ parseXML()

bool pqProxyCategory::parseXML ( vtkPVXMLElement root)

XML Parsing methods.

Parse XML node to create children categories and proxies. Return true if modified.

◆ convertToXML()

void pqProxyCategory::convertToXML ( vtkPVXMLElement root)
inline

Add Proxies and SubCategories XML declaration to root element.

Definition at line 77 of file pqProxyCategory.h.

◆ parseXMLHintsTag()

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:

<Proxy>
<Hints>
<ShowInMenu category="SomeCategory" icon="path/to/icon" />
</Hints>
</Proxy>

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.

◆ convertLegacyXML()

static void pqProxyCategory::convertLegacyXML ( vtkPVXMLElement root)
static

Modify the vtkPVXMLElement for backward compatibility.

◆ writeSettings()

void pqProxyCategory::writeSettings ( const QString &  resourceTag)

Settings methods.

Write categories into ParaView settings.

◆ loadSettings()

void pqProxyCategory::loadSettings ( const QString &  resourceTag)

Load categories from ParaView settings.

◆ copyAttributes()

void pqProxyCategory::copyAttributes ( pqProxyCategory other)

Copy methods.

Copy only the attributes from given category. Proxy list and subcategories are untouched.

◆ deepCopy()

void pqProxyCategory::deepCopy ( pqProxyCategory other)

Deep copy category.

◆ hasProxy()

bool pqProxyCategory::hasProxy ( const QString &  name)

Contained proxies.

Return true if a direct child exists with the given name.

◆ findProxy()

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.

◆ getRootProxies()

QList<pqProxyInfo*> pqProxyCategory::getRootProxies ( )

Return direct child proxies.

◆ getProxiesRecursive()

QList<pqProxyInfo*> pqProxyCategory::getProxiesRecursive ( )

Return proxies including subcategories proxies.

◆ getOrderedRootProxiesNames()

QStringList pqProxyCategory::getOrderedRootProxiesNames ( )

Return direct child proxies names, preserving the declaration order.

◆ findSubCategory()

pqProxyCategory* pqProxyCategory::findSubCategory ( const QString &  name)

Contained categories.

Return contained category by name. If not found, return an empty one.

◆ getSubCategories()

QMap<QString, pqProxyCategory*> pqProxyCategory::getSubCategories ( )

Return contained categories.

◆ getSubCategoriesRecursive()

QMap<QString, pqProxyCategory*> pqProxyCategory::getSubCategoriesRecursive ( )

Return contained categories recursively.

◆ getCategoriesAlphabetically()

QList<pqProxyCategory*> pqProxyCategory::getCategoriesAlphabetically ( )

Return categories by alphabetical name order (case insensitive).

◆ makeUniqueCategoryName()

QString pqProxyCategory::makeUniqueCategoryName ( const QString &  name)

Make "name" unique in category child list by appending a numeric value.

◆ makeUniqueCategoryLabel()

QString pqProxyCategory::makeUniqueCategoryLabel ( const QString &  label)

Make "label" unique in category child list by appending a numeric value.

◆ addCategory() [1/2]

void pqProxyCategory::addCategory ( pqProxyCategory category)

Category children modifiers.

Set given category as a subcategory. Will replace any subcategory with same name.

◆ removeCategory()

void pqProxyCategory::removeCategory ( const QString &  name)

remove child category

◆ addProxy()

void pqProxyCategory::addProxy ( pqProxyInfo info)

add a child proxy

◆ removeProxy()

void pqProxyCategory::removeProxy ( const QString &  name)

remove child proxy

◆ clear()

void pqProxyCategory::clear ( )

Remove children categories and proxies.

◆ hasProxiesRecursive()

bool pqProxyCategory::hasProxiesRecursive ( )

Get properties.

Return true if it has a direct child proxy or any subcategory has a proxy.

◆ parentCategory()

pqProxyCategory* pqProxyCategory::parentCategory ( )
inline

Return parent category.

Definition at line 181 of file pqProxyCategory.h.

◆ isEmpty()

bool pqProxyCategory::isEmpty ( )

Returns true if there is no subcategories and no proxies.

◆ name()

QString pqProxyCategory::name ( )
inline

Return category name.

Definition at line 185 of file pqProxyCategory.h.

◆ label()

QString pqProxyCategory::label ( )

Return category label.

◆ preserveOrder()

bool pqProxyCategory::preserveOrder ( )
inline

Return true if read order should be used in display.

Definition at line 189 of file pqProxyCategory.h.

◆ showInToolbar()

bool pqProxyCategory::showInToolbar ( )
inline

Return true if a toolbar should be created.

Definition at line 191 of file pqProxyCategory.h.

◆ rename()

void pqProxyCategory::rename ( const QString &  name)

Set properties.

Set category name. This also update parent cache.

◆ updateLabel()

void pqProxyCategory::updateLabel ( const QString &  label = "")

Create label from name if empty.

◆ setShowInToolbar()

void pqProxyCategory::setShowInToolbar ( bool  show)

If true, a toolbar will be generated for this category. Default is false.

◆ addCategory() [2/2]

pqProxyCategory* pqProxyCategory::addCategory ( const QString &  name,
vtkPVXMLElement node 
)
protected

Add a category from the xml node.

If a category already exists for given name, return it instead.

◆ cleanDeletedProxy

void pqProxyCategory::cleanDeletedProxy ( QObject *  deleted)
protectedslot

The documentation for this class was generated from the following file: