CustomObjectPanels

From KitwarePublic
Jump to navigationJump to search

Deprecated since 4.0. Although may still be supported for a while, ParaView now doesn't allow customization of entire panels. Instead plugins should add custom widgets for properties (or groups of properties) for similar customizations. Refer to Properties Panel for details.


This page is to answer some questions asked by ParaView users when customizing the GUI.

Object Panels are the panels for editing object properties.

ParaView3 contains automatic panel generation code which is suitable for most objects. If you find your object doesn't have a good auto-generated panel, you can make your own. There are different classes you can derive from depending on how much customization you need to do, or how much existing code you can leverage.

  • pqObjectPanel - the base class for all object panels with limited functionality.
  • pqNamedObjectPanel - if your widgets (line edit, combo boxes, etc..) have names corresponding with the server manager XML, then this class will automatically hook those widgets up with the server manager.
  • pqLoadedFormObjectPanel - if you want to design your form in the Qt Designer, you get a .ui file as a result. You can use this class to load the .ui file. If the names of widgets created in the Qt Designer correspond with server manager objects, they will automatically be hooked up.
  • pqAutoGeneratedObjectPanel - a panel that has widgets automatically created based on the properties of server manager objects. You can extend this if you have small adjustments to make or small features to add.

pqObjectPanel has a pqPropertyLinks instance. This instance is used to manage "links" between server manager properties and the GUI. When a server manager property changes, the GUI is updated. When a GUI property is changed, it is queued up until accept() is called when properties will be set on the vtkSMProperties. To create a link, you call pqPropertyLinks::addPropertyLink().

pqPropertyLinks uses pqSMAdaptor as the api for setting/getting values. The ParaView Server Manager supports boolean/int/double/string and lists of those. The GUI relies on QVariant to convert GUI properties to a boolean/int/double/string value. If the GUI has a property that isn't automatically convertable, an adaptor is needed to do the conversion. An example of that would be converting QRgb to 3 or 4 doubles for rgb or rgba.

An example of that is converting a QRgb color value to 3 r,g,b double values.
QColorDialog color <--> QRgb adapator <--> pqPropertyLinks <--> pqSMAdaptor <--> vtkSMProperty

If you use a pqNamedObjectPanel, these links will automatically be created for you given the names of the QObjects match the name of the vtkSMProperty they correspond with. These links are created by the pqNamedWidgets class, which pqNamedObjectPanel uses, and it supports a limited set of Qt Widgets (QLineEdit, QSlider, QSpinBox, etc..). In ParaView 3.4, pqNamedObjectPanel supports pretty much any Widget (custom ones too), as long as they declare a user property and a matching signal. So using something like a QDateTimeEdit widget in a pqNamedObjectPanel subclass will work automatically.