From 68ff61fcb1317c61adf8ed9f9bb664177fe88538 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 21 Jun 2019 12:53:36 +0300 Subject: [PATCH] Restore reversing state of a filter in GUI --- src/FiltersPlugin/FiltersPlugin_Selection.cpp | 4 +++- src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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); -- 2.39.2