From: vsv Date: Mon, 29 Jul 2019 13:01:15 +0000 (+0300) Subject: Issue #2954: Provide activation/deactivation of filters X-Git-Tag: VEDF2019Lot4~81 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e1ec046d3e8c10acae20d57ec4486bcfd8896b83;p=modules%2Fshaper.git Issue #2954: Provide activation/deactivation of filters --- diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index 2b7763ce2..868ae81c4 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -214,18 +214,6 @@ void ModuleBase_FilterItem::onDelete() emit deleteItem(this); } -QList ModuleBase_FilterItem::getControls() const -{ - QList aWidgetsList; - foreach(ModuleBase_ModelWidget* aWgt, myWidgets) { - QList aSubList = aWgt->getControls(); - foreach(QWidget* aSub, aSubList) { - aWidgetsList.append(aSub); - } - } - return aWidgetsList; -} - //***************************************************************************** //***************************************************************************** @@ -345,7 +333,7 @@ void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) break; } } - onAddFilter(aFilter); + ModuleBase_FilterItem* aItem = onAddFilter(aFilter); FiltersFeaturePtr aFiltersFeature = std::dynamic_pointer_cast(myFeature); aFiltersFeature->addFilter(aFilter); @@ -353,16 +341,21 @@ void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) myFiltersCombo->setCurrentIndex(0); myFiltersCombo->removeItem(theIndex); updateObject(myFeature); + + if (aItem && (aItem->widgets().size() > 0)) + aItem->widgets().first()->emitFocusInWidget(); + else + emitFocusInWidget(); } -void ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string& theFilter) +ModuleBase_FilterItem* ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string& theFilter) { if (theFilter.length() == 0) - return; + return 0; std::list::const_iterator aIt; for (aIt = myUseFilters.cbegin(); aIt != myUseFilters.cend(); aIt++) { if (theFilter == (*aIt)) - return; + return 0; } myFilters.remove(theFilter); myUseFilters.push_back(theFilter); @@ -376,6 +369,7 @@ void ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string& theFilter) updateSelectBtn(); clearCurrentSelection(true); updateNumberSelected(); + return aItem; } void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theItem) @@ -404,7 +398,7 @@ void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theIt myWorkshop->selectionActivate()->updateSelectionModes(); myWorkshop->selectionActivate()->updateSelectionFilters(); redisplayFeature(); - myFiltersCombo->setFocus(); + emitFocusInWidget(); updateObject(myFeature); } @@ -546,13 +540,6 @@ void ModuleBase_WidgetSelectionFilter::updateNumberSelected() QList ModuleBase_WidgetSelectionFilter::getControls() const { QList aWidgets; - QList aItems = myFiltersWgt->findChildren(); - foreach(ModuleBase_FilterItem* aItem, aItems) { - QList aSubList = aItem->getControls(); - foreach(QWidget* aWgt, aSubList) { - aWidgets.append(aWgt); - } - } aWidgets.append(myFiltersCombo); return aWidgets; } diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h index 3c76e55dc..30eb1b342 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h @@ -94,10 +94,6 @@ public: /// Returns filter Id std::string filter() const { return myFilterID; } - /// Returns list of widget controls - /// \return a control list - QList getControls() const; - /// Returns list of widgets which reperesent the current filter GUI QList widgets() const { return myWidgets; @@ -183,9 +179,6 @@ private slots: /// Add a filter by Id in combo box void onAddFilter(int); - /// Add a filter by name - void onAddFilter(const std::string& theFilter); - /// Process deletion of a filter item void onDeleteItem(ModuleBase_FilterItem* theItem); @@ -218,6 +211,9 @@ private: /// Call to redisplay the fiter feature void redisplayFeature(); + /// Add a filter by name + ModuleBase_FilterItem* onAddFilter(const std::string& theFilter); + private: ModuleBase_IWorkshop* myWorkshop;