From: vsv Date: Fri, 21 Jun 2019 09:53:36 +0000 (+0300) Subject: Restore reversing state of a filter in GUI X-Git-Tag: VEDF2019Lot4~101^2~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=68ff61fcb1317c61adf8ed9f9bb664177fe88538;p=modules%2Fshaper.git Restore reversing state of a filter in GUI --- diff --git a/src/FiltersPlugin/FiltersPlugin_Selection.cpp b/src/FiltersPlugin/FiltersPlugin_Selection.cpp index e2dd91f01..2a98fc4ff 100644 --- a/src/FiltersPlugin/FiltersPlugin_Selection.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Selection.cpp @@ -71,7 +71,9 @@ bool FiltersPlugin_Selection::isReversed(const std::string theFilterID) { std::string anAttrID = theFilterID + kFilterSeparator + kReverseAttrID; std::shared_ptr aBool = boolean(anAttrID); - return aBool->value(); + if (aBool.get()) + return aBool->value(); + return false; } std::list FiltersPlugin_Selection::filterArgs(const std::string theFilterID) const diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index 77306e017..54e99f1d2 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -175,9 +175,13 @@ void ModuleBase_FilterItem::addItemRow(QWidget* theParent) // Reverse filter button myRevBtn = new QToolButton(theParent); myRevBtn->setCheckable(true); - myRevBtn->setChecked(false); + bool isReversed = mySelection->isReversed(myFilterID); + myRevBtn->setChecked(isReversed); myRevBtn->setAutoRaise(true); - myRevBtn->setIcon(QIcon(":pictures/add.png")); + if (isReversed) + myRevBtn->setIcon(QIcon(":pictures/reverce.png")); + else + myRevBtn->setIcon(QIcon(":pictures/add.png")); myRevBtn->setToolTip(tr("Reverse the filter")); connect(myRevBtn, SIGNAL(toggled(bool)), SLOT(onReverse(bool))); aLayout->addWidget(myRevBtn);