]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Restore reversing state of a filter in GUI
authorvsv <vsv@opencascade.com>
Fri, 21 Jun 2019 09:53:36 +0000 (12:53 +0300)
committervsv <vsv@opencascade.com>
Fri, 21 Jun 2019 09:53:36 +0000 (12:53 +0300)
src/FiltersPlugin/FiltersPlugin_Selection.cpp
src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp

index e2dd91f01930ef2a488f482183f1f2fabf2fbbb1..2a98fc4ffa6d5cc49997e6e0627876bb37aeab54 100644 (file)
@@ -71,7 +71,9 @@ bool FiltersPlugin_Selection::isReversed(const std::string theFilterID)
 {
   std::string anAttrID = theFilterID + kFilterSeparator + kReverseAttrID;
   std::shared_ptr<ModelAPI_AttributeBoolean> aBool = boolean(anAttrID);
-  return aBool->value();
+  if (aBool.get())
+    return aBool->value();
+  return false;
 }
 
 std::list<AttributePtr> FiltersPlugin_Selection::filterArgs(const std::string theFilterID) const
index 77306e0175d2fe515d026d892b41e16756c0b768..54e99f1d2aa3ff4dac8fcae1f761504e0e17eb2b 100644 (file)
@@ -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);