[Paraview-developers] Help with advanced GUI for filter
Ellon Paiva
ellonpaiva at gmail.com
Tue May 24 10:40:47 EDT 2016
Hello again,
Quick question: is there a way to have a vector property that has N
elements, but only exhibit one of them? If yes, can a descriptor be used
to control which of the vector elements is exhibited?
On 05/23/2016 11:46 PM, Ellon Paiva wrote:
> Utkarsh,
>
> On 05/23/2016 04:27 PM, Utkarsh Ayachit wrote:
>> 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.
>
> Ok. That's good to know: while I was waiting for an answer I
> reimplemented most of the interface using XML files. It's working more
> or less well, apart from a specific widget I'm still having problem
> with (see below). The attached MinimalExample2.tar.gz has the updated
> files.
>
>> 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.
>
> Thanks for pointing out the files with the examples. I looked through
> them today but I still didn't see how I can properly "link" my widget
> with paraview. I'll dig more into it tomorrow. And thanks for pointing
> out the pqPropertyLinks class. Now I see what "AddPropertyLink" method
> does.
>
> Meanwhile, let me explain more: with most of the interface defined
> only in the xml file, the problem is with an specific widget I have
> that *I think* I cannot implement using xml only. Basically, this
> widget allows the user to define a list of "filters", where each
> filter has some parameters. The user can have as much of them as they
> want, and the order of them matters. So, I think that to make this
> work, I'll need:
>
> 1. A StringVectorProperty with the names of the filters. This should
> not be limited by size because as I said the user can have N of
> these. New items are always added in the end, and the selected
> item can be reordered with "Up" and "Down" buttons, or removed
> with "Remove" button;
> *Question*: How do I deal with StringVectorProperties of dynamic
> size? How can I remove and reorder them?
> 2. A vector of of the same size of the filter name vector from 1) for
> each of the possible attribute of the filter that can be set.
> *Q*: How can I manage these vectors of dynamic size? Each
> individually like I should do in 1) or maybe I can use a "group"
> strategy, and create a "vector of a group" of attributes? (Don't
> know if ParaView supports this kind of structure)
> 3. Create a descriptor that will exhibit show/hide attributes based
> on the current item being selected. I've programmed two
> descriptors being used in the attached minimal example, but not
> when the changes depends on a custom widget.
> *Q*: How can I access the current selected item of a QListWidget
> inside my custom widget from a descriptor? Maybe I'll need extra
> attributes (like current/old row and current selected filter name)
> that I'll have to keep synchronized or there's any easier way?
>
>
>>> 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.
>
> pqPropertyWidget::changeAvailable() was exactly what I was looking
> for! :) Thanks!
>
>
> Best,
>
> Ellon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20160524/117e717c/attachment-0001.html>
More information about the Paraview-developers
mailing list