X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParametersPlugin%2FParametersPlugin_WidgetParamsMgr.cpp;h=a08b1572bd5d343b85e313cd1fdb33c99c4cec64;hb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;hp=cebd78a43dae2f0407f18aea9ffe63608a60a9ec;hpb=87b6a30a3afb8fb32e7e43ade8d9c947d9eb1684;p=modules%2Fshaper.git diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index cebd78a43..a08b1572b 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ParametersPlugin_WidgetParamsMgr.h" @@ -176,7 +175,8 @@ void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor, ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData) - : ModuleBase_ModelDialogWidget(theParent, theData) + : ModuleBase_ModelDialogWidget(theParent, theData), + isUpplyBlocked(false) { QVBoxLayout* aLayout = new QVBoxLayout(this); @@ -248,6 +248,20 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP onSelectionChanged(); } +void ParametersPlugin_WidgetParamsMgr::setDialogButtons(QDialogButtonBox* theButtons) +{ + ModuleBase_ModelDialogWidget::setDialogButtons(theButtons); + + QWidget* aBtnParentWgt = myOkCancelBtn->parentWidget(); + QHBoxLayout* aBtnParentLayout = dynamic_cast(aBtnParentWgt->layout()); + + QPushButton* aPreviewBtn = new QPushButton(tr("See preview"), aBtnParentWgt); + aBtnParentLayout->insertWidget(0, aPreviewBtn); + aBtnParentLayout->insertStretch(1, 1); + connect(aPreviewBtn, SIGNAL(clicked(bool)), SLOT(onShowPreview())); +} + + QList ParametersPlugin_WidgetParamsMgr::getControls() const { QList aList; @@ -283,6 +297,11 @@ bool ParametersPlugin_WidgetParamsMgr::storeValueCustom() } aId++; } + // #2813 : make the current feature the latest in the document + std::list allFeatures = myFeature->document()->allFeatures(); + if (!allFeatures.empty()) { + myFeature->document()->setCurrentFeature(*(allFeatures.rbegin()), true); + } return true; } @@ -311,7 +330,7 @@ void ParametersPlugin_WidgetParamsMgr::updateParametersFeatures() int aNbFeatures = aDoc->numInternalFeatures(); for (int i = 0; i < aNbFeatures; i++) { aParamFeature = aDoc->internalFeature(i); - if (aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { + if (aParamFeature && aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { myParametersList.append(aParamFeature); } } @@ -783,3 +802,26 @@ bool ParametersPlugin_WidgetParamsMgr::isValid() return true; } +void ParametersPlugin_WidgetParamsMgr::showEvent(QShowEvent* theEvent) +{ + ModuleBase_ModelDialogWidget::showEvent(theEvent); + SessionPtr aMgr = ModelAPI_Session::get(); + isUpplyBlocked = aMgr->isAutoUpdateBlocked(); + aMgr->blockAutoUpdate(true); + Events_Loop* aLoop = Events_Loop::loop(); + aLoop->flush(aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE)); +} + +void ParametersPlugin_WidgetParamsMgr::hideEvent(QHideEvent* theEvent) +{ + ModuleBase_ModelDialogWidget::hideEvent(theEvent); + SessionPtr aMgr = ModelAPI_Session::get(); + aMgr->blockAutoUpdate(isUpplyBlocked); +} + +void ParametersPlugin_WidgetParamsMgr::onShowPreview() +{ + SessionPtr aMgr = ModelAPI_Session::get(); + aMgr->blockAutoUpdate(false); + aMgr->blockAutoUpdate(true); +} \ No newline at end of file