[Paraview-developers] Help with advanced GUI for filter
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Mon May 23 10:27:55 EDT 2016
Ellon,
> How can I access the values set from on this widget in my filter class
> (which is a subclass of vtkPolyDataAlgorithm, see files attached)? When I
> was creating the interface using XML files only the changes were stored in
> filter attributes through Set/Get methods, and thus accessible into
> RequestData(), but I don't see how to do it from the widget I created now.
Alas, I'll recommend going back to your previous approach of having
everyting go through filter attributes with Get/Set methods and then
add XML properties for all. That's indeed the way to go. To create a
custom widget for a group of properties, all you have to do is put a
XML element like following in your proxy definition and then define a
custom widget for that group
(http://www.paraview.org/Wiki/ParaView/Properties_Panel#Property_Groups).
Using panel_widget attribute on the group XML, you can tell which
custom widget to create. See existing examples in ParaView, e.g.
pqColorOpacityEditorWidget, it provides a nice demonstration of how
you can use Qt properties and pqPropertyLinks to cleanly hookup UI
items and several properties in the proxy. A simpler example is
pqFontPropertyWidget.
> The Apply button in the interface is does not change to enabled state
> automatically when changing the options in the widged. I tried to emit a
> changeFinished() signal but it didn't enable the Apply button. How can I
> achieve this behavior?
Anytime the user changes the UI, just fire
pqPropertyWidget::changeAvailable(). That should suffice in most
cases. In cases rare cases, you have to fire changeAvailable() and
changeFinished() separately, but we can ignore that until you run into
it.
> I'm implementing the widget display logic inside the widget class. Is that
> OK or should I do it using pqPropertyWidgetDecorator? Is there any
> preferable way or doesn't matter?
That's okay. Decorators are only meant to do minimal tasks like
controlling whether to show/hide/enable/disable the widget.
More information about the Paraview-developers
mailing list