Commit 0f042e97 authored by Timothee Chabat's avatar Timothee Chabat
Browse files

WIP: tries to fix applied state

parent acec2f85
......@@ -286,16 +286,10 @@ pqInteractivePropertyWidget::pqInteractivePropertyWidget(const char* widget_smgr
internals.ApplyConnectionObserver =
QObject::connect(pqApplicationCore::instance()->getServerManagerModel(),
&pqServerManagerModel::dataUpdated, [this, &internals](pqPipelineSource* source) {
if (!internals.HasSourceBeenApplied && source->getProxy() == internals.Source.Proxy)
{
internals.HasSourceBeenApplied = true;
this->updateWidgetVisibility();
// Unregister this connection once we know the filter has been applied
QObject::disconnect(internals.ApplyConnectionObserver);
}
&pqServerManagerModel::dataUpdated, [this](pqPipelineSource*) {
this->updateParentState();
});
this->updateParentState();
// This ensures that when the user changes the Qt widget, we re-render to show
// the update widget.
......@@ -307,6 +301,35 @@ pqInteractivePropertyWidget::pqInteractivePropertyWidget(const char* widget_smgr
vtkCommand::UserEvent, this, &pqInteractivePropertyWidget::handleUserEvent);
}
//-----------------------------------------------------------------------------
void pqInteractivePropertyWidget::updateParentState()
{
vtkSMSourceProxy* proxy = this->Internals->Source.Proxy;
if (proxy)
{
auto* info = proxy->GetDataInformation();
int created = info->GetMemorySize();
// std::cout << "Port created: " << created << std::endl;
std::cout << "Mem: " << info->GetMemorySize() << std::endl;
if (created)
{
this->Internals->HasSourceBeenApplied = true;
this->updateWidgetVisibility();
// Unregister this connection once we know the filter has been applied
QObject::disconnect(this->Internals->ApplyConnectionObserver);
}
}
// if (!this->Internals->HasSourceBeenApplied && source->getProxy() == this->Internals->Source.Proxy)
// {
// internals.HasSourceBeenApplied = true;
// this->updateWidgetVisibility();
// // Unregister this connection once we know the filter has been applied
// QObject::disconnect(internals.ApplyConnectionObserver);
// }
}
//-----------------------------------------------------------------------------
pqInteractivePropertyWidget::~pqInteractivePropertyWidget()
{
......
......@@ -226,6 +226,8 @@ private:
*/
void setupCurrentDataRepresentation();
void updateParentState();
private:
Q_DISABLE_COPY(pqInteractivePropertyWidget)
......
......@@ -353,18 +353,6 @@ int vtkSMProxyListDomain::SetDefaultValues(vtkSMProperty* prop, bool use_uncheck
vtkSMProxy* values[1] = { this->GetProxy(this->GetDefaultIndex()) };
helper.Set(values, 1);
// Below is a lead on how to fix some issue for the interactive widget but this cause
// some leaks in the TestSettings test for example
// const unsigned int nProx = this->GetNumberOfProxies();
// std::vector<vtkSMProxy*> values(nProx);
// for (unsigned int i = 0; i < nProx; ++i)
// {
// values[i] = this->GetProxy(i);
// }
// helper.Set(values.data(), nProx, nullptr);
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment