1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetMultiSelectorComposite.cpp
4 // Created: 17 Mar 2016
5 // Author: Natalia Ermolaeva
7 #include "PartSet_WidgetMultiSelectorComposite.h"
9 PartSet_WidgetMultiSelectorComposite::PartSet_WidgetMultiSelectorComposite(QWidget* theParent,
10 ModuleBase_IWorkshop* theWorkshop,
11 const Config_WidgetAPI* theData)
12 : ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData)
16 PartSet_WidgetMultiSelectorComposite::~PartSet_WidgetMultiSelectorComposite()
20 bool PartSet_WidgetMultiSelectorComposite::focusTo()
22 bool aCanHaveFocus = true;
24 if (hasSubObjects()) {
25 // disable widget controls
27 aCanHaveFocus = false;
30 aCanHaveFocus = ModuleBase_WidgetMultiSelector::focusTo();
34 void PartSet_WidgetMultiSelectorComposite::setEditingMode(bool isEditing)
36 ModuleBase_ModelWidget::setEditingMode(isEditing);
37 bool aHasSubObjects = hasSubObjects();
42 bool PartSet_WidgetMultiSelectorComposite::hasSubObjects() const
44 bool aHasSubObjects = false;
46 bool aCanSetFocus = true;
47 CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
49 aHasSubObjects = aComposite->numberOfSubs() > 0;
50 return aHasSubObjects;
53 void PartSet_WidgetMultiSelectorComposite::disableControls()
55 QList<QWidget*> aMyControls = getControls();
56 foreach(QWidget* eachControl, aMyControls) {
57 eachControl->setFocusPolicy(Qt::NoFocus);
58 eachControl->setEnabled(false);