1 // Copyright (C) 2010-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay
21 #include "pqMEDReaderReloadWidget.h"
23 #include "vtkSMProxy.h"
24 #include "vtkSMSourceProxy.h"
25 #include "vtkSMProperty.h"
27 #include "pqPropertiesPanel.h"
29 #include <QPushButton>
30 #include <QGridLayout>
32 pqMEDReaderReloadWidget::pqMEDReaderReloadWidget(vtkSMProxy *smProxy,
33 vtkSMProperty *proxyProperty,
35 : pqPropertyWidget(smProxy, pWidget),
36 Property(proxyProperty)
38 this->setShowLabel(false);
41 QGridLayout* gridLayout = new QGridLayout(this);
42 gridLayout->setAlignment(Qt::AlignRight);
45 QPushButton *button = new QPushButton();
46 button->setIcon(QIcon(":/ParaViewResources/Icons/pqReloadFile16.png"));
47 button->setFixedSize(button->sizeHint());
48 gridLayout->addWidget(button);
51 connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
54 pqMEDReaderReloadWidget::~pqMEDReaderReloadWidget()
58 void pqMEDReaderReloadWidget::buttonClicked()
60 // Recovering Property Panel
61 pqPropertiesPanel* panel = NULL;
70 panel = qobject_cast<pqPropertiesPanel*>(tmp);
75 qDebug() << "Cannot find pqPropertiesPanel, reload may not work";
79 // Restoring property to defaults, necessary when unchecked property are not applied
80 panel->propertiesRestoreDefaults();
83 // Reloading the data and associated properties
84 this->Property->Modified();
85 this->proxy()->UpdateProperty(this->proxy()->GetPropertyName(this->Property));
86 vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipelineInformation();
88 // Restting properties to dufault using domains and XML values
89 this->proxy()->ResetPropertiesToDefault();
93 // Disabled apply button inderectly
94 panel->propertiesRestoreDefaults();