<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Utkarsh,<br>
<br>
<div class="moz-cite-prefix">On 05/23/2016 04:27 PM, Utkarsh Ayachit
wrote:<br>
</div>
<blockquote
cite="mid:CADHSJjCPpLYEeiNeXOKqPE2Zmk04cqvEgOD-kvYE=skVYCKugQ@mail.gmail.com"
type="cite">
<pre wrap="">Ellon,
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap="">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. </pre>
</blockquote>
<br>
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.<br>
<br>
<blockquote
cite="mid:CADHSJjCPpLYEeiNeXOKqPE2Zmk04cqvEgOD-kvYE=skVYCKugQ@mail.gmail.com"
type="cite">
<pre wrap="">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
(<a class="moz-txt-link-freetext" href="http://www.paraview.org/Wiki/ParaView/Properties_Panel#Property_Groups">http://www.paraview.org/Wiki/ParaView/Properties_Panel#Property_Groups</a>).
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.</pre>
</blockquote>
<br>
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.<br>
<br>
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:<br>
<ol>
<li>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;<br>
<b>Question</b>: How do I deal with StringVectorProperties of
dynamic size? How can I remove and reorder them?<br>
</li>
<li>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.<br>
<b>Q</b>: 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)<br>
</li>
<li>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.<br>
<b>Q</b>: 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?<br>
</li>
</ol>
<br>
<blockquote
cite="mid:CADHSJjCPpLYEeiNeXOKqPE2Zmk04cqvEgOD-kvYE=skVYCKugQ@mail.gmail.com"
type="cite">
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap="">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.</pre>
</blockquote>
<br>
pqPropertyWidget::changeAvailable() was exactly what I was looking
for! :) Thanks!<br>
<br>
<br>
Best,<br>
<br>
Ellon<br>
<br>
</body>
</html>