MakingCustomPanels

From ParaQ Wiki
Revision as of 16:25, 4 May 2006 by Clinton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Making Custom Panels in ParaQ

We have these panel classes in ParaQ:

  • pqObjectPanel base class for all panels
  • pqNamedObjectPanel base class for panels with widgets named after proxy properties
  • pqLoadedFormObjectPanel concrete class for panels loaded from ui files or resources (derived from pqNamedObjectPanel)
  • pqAutoGeneratedObjectPanel concrete class for auto generated panels (derived from pqNamedObjectPanel)


There are a few different ways to make custom panels.

  • Use pqLoadedFormObjectPanel to load a ui file you created in the designer. Widgets must be named after the proxy property to make automatic connections.
  • Use pqNamedObjectPanel to make your own proxy-named widgets. One could leverage the auto connections made and add behavior to the panels. For example, in C++, one could change the visibility of certain widgets based on values in other widgets.
  • Derive from pqObjectPanel and implement the whole panel ground up in C++.


At any of these levels, a few other classes can be used to communicate with the server manager.

  • pqSMAdaptor to get/set proxy properties
  • pqPropertyLinks to link a QObject property with a proxy property. For example, a slider bar can link with a proxy's timestep. Qt signals are used to set the property on the proxy, and property modified events are used to set the Qt object property.
  • pqPropertyManager used to queue QObject property modifications until accept is pressed. Also keeps multiple GUI widgets in sync if they are both linked to the same property.

This stuff isn't set in stone, and some of it will be revisited to work better with undo/redo. And also revisited to support domains better.


The API for pqPropertyManager

 /// register a QObject property to link with the server manager
 void registerLink(QObject* qObject, const char* qProperty, const char* signal,
                      vtkSMProxy* Proxy, vtkSMProperty* Property, int Index=-1);

 /// unregister a QObject property to link with the server manager
 void unregisterLink(QObject* qObject, const char* qProperty, const char* signal,
                         vtkSMProxy* Proxy, vtkSMProperty* Property, int Index=-1);

A QObject's property (example, QTextEdit's text property) can be linked with a proxy's property. All accept/reset, undo/redo stuff is handled automatically for widgets which use these functions.