Public Types | Public Member Functions | Static Public Member Functions | List of all members
pqProxyInfo Class Reference

Meta data structure for the User Interface, describing an item of a pqProxyCategory. More...

#include <pqProxyInfo.h>

Inherits QObject.

Public Types

enum  ItemType { ItemType::Proxy, ItemType::Script, ItemType::Separator }
 Type of item. More...
 

Public Member Functions

 pqProxyInfo (pqProxyCategory *parent, const QString &name, const QString &group, const QString &label, const QString &icon="", const QStringList &omitFromToolbar=QStringList(), bool hideFromMenu=false)
 
 pqProxyInfo (pqProxyCategory *parent, pqProxyInfo *other)
 create a pqProxyInfo with same attributes as other. More...
 
 pqProxyInfo (pqProxyCategory *parent, vtkPVXMLElement *xmlElement)
 
 pqProxyInfo ()=default
 
void setLabel (const QString &label)
 Set label. More...
 
void setName (const QString &name)
 Set the name. More...
 
void setHideFromMenu (bool hidden)
 Set HideFromMenu. More...
 
void setIcon (const QString &iconPath)
 Set Icon path. More...
 
void setOmitFromToolbar (const QString &categoryName, bool omit)
 Set whether the item is omitted from the toolbar of the given category. More...
 
void merge (pqProxyInfo *other)
 Merge pqProxyInfo meta data into self. More...
 
void convertToXML (vtkPVXMLElement *root)
 Create the xml element and add it under given root. More...
 
bool isValid () const
 Returns true if the item has the required information, which depends on its type: a name and group for proxies, a name and either code or a file name for scripts. More...
 
bool hasSameCustomizableAttributes (pqProxyInfo *other)
 Returns true if the attributes that can be customized by users, i.e. More...
 
QString name ()
 Return member. More...
 
QString group ()
 Return member. More...
 
QString label ()
 return the translated label, or create one from name if empty. More...
 
QString icon ()
 Return member. More...
 
QStringList omitFromToolbar ()
 Return member. More...
 
bool hideFromMenu ()
 Return member. More...
 
ItemType type () const
 Return member. More...
 
bool isProxy () const
 Return member. More...
 
bool isScript () const
 Return member. More...
 
bool isSeparator () const
 Return member. More...
 
QString script () const
 for scripts: the Python code, if provided inline. More...
 
QString fileName () const
 for scripts: the file containing the Python code, if provided. More...
 
QString toolTip () const
 for scripts: the tooltip. More...
 

Static Public Member Functions

static QMap< QString, QPointer< pqProxyInfo > > mergeProxies (const QMap< QString, QPointer< pqProxyInfo >> &proxies, const QMap< QString, QPointer< pqProxyInfo >> &otherProxies)
 Merge otherProxies into proxies and return a new map. More...
 

Detailed Description

Meta data structure for the User Interface, describing an item of a pqProxyCategory.

Items are mostly proxies i.e. sources or filters, but can also be Python scripts and separators. In XML, they are respectively described using the Proxy, Script and Separator elements:

<Proxy group="filters" name="Clip" icon=":/pqWidgets/Icons/pqClip.svg" />
<Script name="Hello" label="Say Hello" tooltip="Prints a greeting.">
print("Hello!")
</Script>
<Separator />

A Script can also provide its code using a filename attribute instead.

Definition at line 33 of file pqProxyInfo.h.

Member Enumeration Documentation

◆ ItemType

enum pqProxyInfo::ItemType
strong

Type of item.

Enumerator
Proxy 
Script 
Separator 

Definition at line 46 of file pqProxyInfo.h.

Constructor & Destructor Documentation

◆ pqProxyInfo() [1/4]

pqProxyInfo::pqProxyInfo ( pqProxyCategory *  parent,
const QString &  name,
const QString &  group,
const QString &  label,
const QString &  icon = "",
const QStringList &  omitFromToolbar = QStringList(),
bool  hideFromMenu = false 
)

◆ pqProxyInfo() [2/4]

pqProxyInfo::pqProxyInfo ( pqProxyCategory *  parent,
pqProxyInfo *  other 
)

create a pqProxyInfo with same attributes as other.

◆ pqProxyInfo() [3/4]

pqProxyInfo::pqProxyInfo ( pqProxyCategory *  parent,
vtkPVXMLElement *  xmlElement 
)

◆ pqProxyInfo() [4/4]

pqProxyInfo::pqProxyInfo ( )
default

Member Function Documentation

◆ setLabel()

void pqProxyInfo::setLabel ( const QString &  label)

Set label.

◆ setName()

void pqProxyInfo::setName ( const QString &  name)
inline

Set the name.

Must be done before adding it to a category.

Definition at line 68 of file pqProxyInfo.h.

◆ setHideFromMenu()

void pqProxyInfo::setHideFromMenu ( bool  hidden)

Set HideFromMenu.

◆ setIcon()

void pqProxyInfo::setIcon ( const QString &  iconPath)

Set Icon path.

◆ setOmitFromToolbar()

void pqProxyInfo::setOmitFromToolbar ( const QString &  categoryName,
bool  omit 
)

Set whether the item is omitted from the toolbar of the given category.

◆ merge()

void pqProxyInfo::merge ( pqProxyInfo *  other)

Merge pqProxyInfo meta data into self.

Append OmitFromToolbar values. For other properties, keep those from self if non empty, else copy other.

◆ mergeProxies()

static QMap<QString, QPointer<pqProxyInfo> > pqProxyInfo::mergeProxies ( const QMap< QString, QPointer< pqProxyInfo >> &  proxies,
const QMap< QString, QPointer< pqProxyInfo >> &  otherProxies 
)
static

Merge otherProxies into proxies and return a new map.

◆ convertToXML()

void pqProxyInfo::convertToXML ( vtkPVXMLElement *  root)

Create the xml element and add it under given root.

◆ name()

QString pqProxyInfo::name ( )
inline

Return member.

Definition at line 108 of file pqProxyInfo.h.

◆ group()

QString pqProxyInfo::group ( )
inline

Return member.

Definition at line 109 of file pqProxyInfo.h.

◆ label()

QString pqProxyInfo::label ( )

return the translated label, or create one from name if empty.

◆ icon()

QString pqProxyInfo::icon ( )
inline

Return member.

Definition at line 112 of file pqProxyInfo.h.

◆ omitFromToolbar()

QStringList pqProxyInfo::omitFromToolbar ( )
inline

Return member.

Definition at line 113 of file pqProxyInfo.h.

◆ hideFromMenu()

bool pqProxyInfo::hideFromMenu ( )

Return member.

◆ type()

ItemType pqProxyInfo::type ( ) const
inline

Return member.

Definition at line 115 of file pqProxyInfo.h.

◆ isProxy()

bool pqProxyInfo::isProxy ( ) const
inline

Return member.

Definition at line 116 of file pqProxyInfo.h.

◆ isScript()

bool pqProxyInfo::isScript ( ) const
inline

Return member.

Definition at line 117 of file pqProxyInfo.h.

◆ isSeparator()

bool pqProxyInfo::isSeparator ( ) const
inline

Return member.

Definition at line 118 of file pqProxyInfo.h.

◆ script()

QString pqProxyInfo::script ( ) const
inline

for scripts: the Python code, if provided inline.

Definition at line 120 of file pqProxyInfo.h.

◆ fileName()

QString pqProxyInfo::fileName ( ) const
inline

for scripts: the file containing the Python code, if provided.

Definition at line 122 of file pqProxyInfo.h.

◆ toolTip()

QString pqProxyInfo::toolTip ( ) const
inline

for scripts: the tooltip.

Definition at line 124 of file pqProxyInfo.h.

◆ isValid()

bool pqProxyInfo::isValid ( ) const

Returns true if the item has the required information, which depends on its type: a name and group for proxies, a name and either code or a file name for scripts.

◆ hasSameCustomizableAttributes()

bool pqProxyInfo::hasSameCustomizableAttributes ( pqProxyInfo *  other)

Returns true if the attributes that can be customized by users, i.e.

icon and visibility in menus and toolbars, are the same for both items. For the toolbar visibility, only the parent categories are considered.


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