Hi Utkarsh, With many thanks to your hints, I also dug around to see what command_button was doing and this corresponds nicely what I needed. I'll put it here for anyone browsing the archives.
Cheers /mark void fireCommand(vtkSMProperty* prop) { vtkSMProxy* pxy = this->proxy(); prop->Modified(); pxy->UpdateProperty(pxy->GetPropertyName(prop)); } void fireCommand(vtkSMIntVectorProperty* prop, bool checked) { vtkSMProxy* pxy = this->proxy(); prop->SetElement(0, checked); // Toogle bool prop->Modified(); pxy->UpdateProperty(pxy->GetPropertyName(prop)); } ________________________________________ From: Utkarsh Ayachit <utkarsh.ayac...@kitware.com> Sent: Tuesday, January 10, 2017 9:05 PM To: Mark Olesen Cc: paraview@paraview.org Subject: Re: [Paraview] upgrading reader module/plugin Mark, After you've changed a property, you need to call vtkSMProxy::UpdateVTKObjects() (or vtkSMProxy::UpdateProperty()) to push those values for them to have any effect. However, in a panel, you'd rather not do that. Utkarsh On Mon, Jan 9, 2017 at 12:31 PM, Mark Olesen <mark.ole...@esi-group.com> wrote: > The SetImmediateUpdate seems be needed for cases where I do bypass the > addPropertyLink mechanism. Eg, > > QCheckBox* b = new QCheckBox(this); > setButtonProperties(b, showPointNumbers_); //<- text, tips etc... > form->addWidget(b, 0, 1, Qt::AlignLeft); > > connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool))); > showPointNumbers_->SetImmediateUpdate(true); > > and then > > void pqFoamBlockMeshControls::showPointNumbers(bool checked) > { > showPointNumbers_->SetElement(0, checked); > > // Update the active view > if (this->view()) > { > this->view()->render(); > } > } > > Without the SetImmediateUpdate, the toggle of the showPointNumbers property > doesn't get propagated to the reader until sometime later. Maybe the key is > to signal directly to the reader? > > ________________________________________ > From: Utkarsh Ayachit <utkarsh.ayac...@kitware.com> > Sent: Monday, January 9, 2017 4:18 PM > To: Mark Olesen > Cc: paraview@paraview.org > Subject: Re: [Paraview] upgrading reader module/plugin > > I don't think `SetImmediateUpdate` should be needed any more. Are you > sure it's needed? If I remember correctly, it's one of the obselete > ivars that should truly be deprecated and removed. > > On Mon, Jan 9, 2017 at 4:10 AM, Mark Olesen <mark.ole...@esi-group.com> wrote: >> Hi Utkarsh, >> >> The addPropertyLink works exactly as desired and triggers the necessary >> update mechanism. For a few places I still have direct connect() to catch >> the signal and do something additional with it, but that was expected. I >> don't know why I still need an SetImmediateUpdate to get the changes >> propagated properly, but that can wait. The most important thing is that I >> can now load my reader module in paraview 5.2 and move forward. >> >> Thank you, >> /mark >> >> ________________________________________ >> From: Utkarsh Ayachit <utkarsh.ayac...@kitware.com> >> Sent: Thursday, January 5, 2017 4:52:32 AM >> To: Mark Olesen >> Cc: paraview@paraview.org >> Subject: Re: [Paraview] upgrading reader module/plugin >> >> Mark, >> >> As you can expect, connecting Qt widgets to vtkSMProperty's on proxies >> in a two-way-link is common in ParaView panels and hence ParaView >> provides quite a few ways for doing that. For your use-case, where >> you're connecting a QCheckBox to an IntVectorProperty on the proxy, >> your pqPropertyWidget subclass can do something like the following: >> >> Assuming your XML for the group is as follows: >> >> QCheckBox *checkbox = ... >> vtkSMProperty* smProperty = smgroup->GetProperty("InterpolateFields"); >> this->addPropertyLink(checkbox, "checked", SIGNAL(toggled(bool), smProperty); >> >> That should do it. >> >> Utkarsh >> >> On Wed, Jan 4, 2017 at 9:48 AM, Mark Olesen <mark.ole...@esi-group.com> >> wrote: >>> I'm currently upgrading a reader module from using a >>> pqAutoGeneratedObjectPanel to a using a property group widget (as per >>> http://www.paraview.org/Wiki/Plugin_HowTo#Adding_Customizations_for_Properties_Panel). >>> >>> I have my bunch of properties in a PropertyGroup and have a panel_widget >>> associated with them. Everything loads up, and using printf() I can verify >>> that the property values are all being updated. >>> However, not only does it seems rather clunky, I cannot get the "Apply" >>> button on the property panel to notice when the property values have been >>> updated. >>> >>> Here's a basic sketch of what I have: >>> >>> // Get the property from the group (with down-cast): >>> interpolateFields_ = group->GetProperty("interpolate"); >>> >>> // Provide a checkbox as widget for it - two-column layout. >>> QCheckBox* b = new QCheckBox(prop->GetXMLLabel(), this); >>> form->addWidget(b, row, col, Qt::AlignLeft); >>> >>> // Connect to slot: >>> connect(b, SIGNAL(toggled(bool)), this, SLOT(interpolateFields(bool))); >>> >>> // This is ugly, but seems to be needed??? >>> interpolateFields_->SetImmediateUpdate(true); >>> >>> // And the slot itself >>> void interpolateFields(bool checked) >>> { >>> interpolateFields_->SetElement(0, checked); >>> // this->setModified(); >>> //^^^ used to work with pqAutoGeneratedObjectPanel >>> } >>> >>> I used to rely on the setModified() method from the >>> pqAutoGeneratedObjectPanel, but now can't seem to get from the SMproxy to >>> the pqProxy or whatever. >>> >>> Or am I going about this entirely the wrong way? >>> FWIW, here are the relevant sub-entries from the XML, in case there is >>> something missing there: >>> >>> <IntVectorProperty >>> name="InterpolateFields" >>> command="SetInterpolateVolFields" >>> number_of_elements="1" >>> default_values="1" >>> animateable="0"> >>> <BooleanDomain name="bool"/> >>> <Documentation></Documentation> >>> </IntVectorProperty> >>> >>> <PropertyGroup >>> label="General Controls" >>> panel_widget="my_reader_controls"> >>> <Property name="InterpolateFields"/> >>> ... >>> </PropertyGroup> >>> >>> Unfortunately, the Examples/Plugins/PropertyWidgets is a bit scanty here. >>> >>> Thanks for any advice, >>> >>> /mark >>> >>> >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the ParaView Wiki at: >>> http://paraview.org/Wiki/ParaView >>> >>> Search the list archives at: http://markmail.org/search/?q=ParaView >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/paraview _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview