emit deleteItem(this);
}
-QList<QWidget*> ModuleBase_FilterItem::getControls() const
-{
- QList<QWidget*> aWidgetsList;
- foreach(ModuleBase_ModelWidget* aWgt, myWidgets) {
- QList<QWidget*> aSubList = aWgt->getControls();
- foreach(QWidget* aSub, aSubList) {
- aWidgetsList.append(aSub);
- }
- }
- return aWidgetsList;
-}
-
//*****************************************************************************
//*****************************************************************************
break;
}
}
- onAddFilter(aFilter);
+ ModuleBase_FilterItem* aItem = onAddFilter(aFilter);
FiltersFeaturePtr aFiltersFeature =
std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(myFeature);
aFiltersFeature->addFilter(aFilter);
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<std::string>::const_iterator aIt;
for (aIt = myUseFilters.cbegin(); aIt != myUseFilters.cend(); aIt++) {
if (theFilter == (*aIt))
- return;
+ return 0;
}
myFilters.remove(theFilter);
myUseFilters.push_back(theFilter);
updateSelectBtn();
clearCurrentSelection(true);
updateNumberSelected();
+ return aItem;
}
void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theItem)
myWorkshop->selectionActivate()->updateSelectionModes();
myWorkshop->selectionActivate()->updateSelectionFilters();
redisplayFeature();
- myFiltersCombo->setFocus();
+ emitFocusInWidget();
updateObject(myFeature);
}
QList<QWidget*> ModuleBase_WidgetSelectionFilter::getControls() const
{
QList<QWidget*> aWidgets;
- QList<ModuleBase_FilterItem*> aItems = myFiltersWgt->findChildren<ModuleBase_FilterItem*>();
- foreach(ModuleBase_FilterItem* aItem, aItems) {
- QList<QWidget*> aSubList = aItem->getControls();
- foreach(QWidget* aWgt, aSubList) {
- aWidgets.append(aWgt);
- }
- }
aWidgets.append(myFiltersCombo);
return aWidgets;
}
/// Returns filter Id
std::string filter() const { return myFilterID; }
- /// Returns list of widget controls
- /// \return a control list
- QList<QWidget*> getControls() const;
-
/// Returns list of widgets which reperesent the current filter GUI
QList<ModuleBase_ModelWidget*> widgets() const {
return myWidgets;
/// 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);
/// Call to redisplay the fiter feature
void redisplayFeature();
+ /// Add a filter by name
+ ModuleBase_FilterItem* onAddFilter(const std::string& theFilter);
+
private:
ModuleBase_IWorkshop* myWorkshop;