ParaView/Properties Panel
ParaView 4.0 comes with an revamped properties panel. This page documents the new features and capabilities of the panel.
Changes since 3.x
The major GUI change between ParaView 3.x and 4.x is that the "Properties" and "Display" tabs in the object inspector have now been combined into a single "Properties" tab with a new interface. The new interface also features a search bar to allow users to easily find the controls for a certain property.
Implementation Details
The pqPropertiesPanel class
The central class in the new properties panel framework is pqPropertiesPanel. It inherits QWidget and by default is placed in a QDockWidget in the lower-left of the ParaView window. The two main API methods are setProxy(pqProxy *proxy) and setRepresentation(pqRepresentation *repr). The setProxy() method is called each time the current proxy is changed (e.g. the user creates a new sphere source or clicks a different object in the pipeline inspector) and will populate the top-half of the panel with the controls for the proxy. The setRepresentation() method is called each time the current representation changes (e.g. a different representation is select in the representation combo-box) and will populate the bottom-half of the panel with controls for the representation.
When the current proxy or representation changes the properties panel will read the XML object for each property in the proxy and create the appropriate subclass of pqPropertyWidget for it. This is done through the static pqPropertiesPanel::createWidgetForProperty(vtkSMProperty *property, vtkSMProxy *proxy, QWidget *parent = 0) method. This method is static so that other parts of ParaView can use it to provide a GUI widget for controlling a specific property on a proxy. The pqPropertyWidget class has a number of subclasses which implement a wide range of controls for each type of ParaView property (e.g. IntVectorProperty, StringVectorProperty, etc.).
The pqPropertyWidget class
The pqPropertyWidget class is the base class for all widgets controlling the value of a vtkSMProperty. A few generic implementations are provided for ParaView's property types:
- pqIntVectorPropertyWidget for vtkSMIntVectorProperty
- pqDoubleVectorPropertyWidget for vtkSMDoubleVectorProperty
- pqStringVectorPropertyWidget for vtkSMStringVectorProperty
- pqProxyVectorPropertyWidget for vtkSMProxyVectorProperty
Furthermore each of the basic property widget types will specialize and display themseleves based on the domain(s) of the property. For example, a vtkSMIntVectorProperty with a vtkSMBooleanRangeDomain will receive a QCheckBox.
XML Attributes
The XML for the proxy and property definitions allow for developers to control how the controls for their proxy are shown to the user.
The panel_visibility attribute allows for the visibility of the widget on the panel to be modified.
Valid values for panel_visibility are:
- "default" - always shown on the panel
- "advanced" - only shown when the advanced button is clicked
- "never" - never shown on the panel
For example, the following property will only be shown when the user clicks the advanced button in the properties panel:
<source lang="xml">
<IntVectorProperty name="PhiResolution" panel_visibility="advanced"> </IntVectorProperty>
</source>
Debuging
Setting the PV_DEBUG_PANELS enviornmental variable will cause the pqPropertiesPanel class to print out the reason for creating each property widget.
For example, after doing export PV_DEBUG_PANELS, running ParaView, and creating a Sphere source the following will be printed:
Creating panel widgets for the Sphere proxy: - Center ( Center ) gets a pqDoubleVectorPropertyWidget containing a "List of QLineEdit's for an DoubleVectorProperty with an DoubleRangeDomain (range) and more than one element" - Radius ( Radius ) gets a pqDoubleVectorPropertyWidget containing a "List of QLineEdit's for an DoubleVectorProperty with an DoubleRangeDomain (range) and more than one element" - ThetaResolution ( Theta Resolution ) gets a pqIntVectorPropertyWidget containing a "List of QLineEdit's for an IntVectorProperty with an IntRangeDomain (range) and more than one element" - StartTheta ( Start Theta ) gets a pqDoubleVectorPropertyWidget containing a "pqDoubleRangeWidget for an DoubleVectorProperty with a single element and a DoubleRangeDomain (range) with a minimum and a maximum" - EndTheta ( End Theta ) gets a pqDoubleVectorPropertyWidget containing a "pqDoubleRangeWidget for an DoubleVectorProperty with a single element and a DoubleRangeDomain (range) with a minimum and a maximum" - PhiResolution ( Phi Resolution ) gets a pqIntVectorPropertyWidget containing a "List of QLineEdit's for an IntVectorProperty with an IntRangeDomain (range) and more than one element" - StartPhi ( Start Phi ) gets a pqDoubleVectorPropertyWidget containing a "pqDoubleRangeWidget for an DoubleVectorProperty with a single element and a DoubleRangeDomain (range) with a minimum and a maximum" - EndPhi ( End Phi ) gets a pqDoubleVectorPropertyWidget containing a "pqDoubleRangeWidget for an DoubleVectorProperty with a single element and a DoubleRangeDomain (range) with a minimum and a maximum"
Auto-Apply
The new properties panel retains the "auto-apply" functionality of the previous properties panel. This is implemented by automatically calling pqPropertiesPanel::apply() whenever a property widget is modified. The auto-apply function can be set by the user in the Edit->Settings menu or progromatically with the pqPropertiesPanel::setAutoApply(bool enabled) method. Additionally, a time delay may be introduced with the pqPropertiesPanel::setAutoApplyDelay(int msec) method.