Salome HOME
using the previous type of Circle/Arc during reentrant operation. First correction...
[modules/shaper.git] / src / ModuleBase / ModuleBase_IPropertyPanel.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * ModuleBase_IPropertyPanel.cpp
5  *
6  *  Created on: Oct 01, 2014
7  *      Author: vsv
8  */
9
10 #include "ModuleBase_IPropertyPanel.h"
11 #include "ModuleBase_ModelWidget.h"
12 #include "ModuleBase_ToolBox.h"
13
14 #include <ModelAPI_Validator.h>
15 #include <ModelAPI_Session.h>
16
17 ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget* theParent) : QDockWidget(theParent), myIsEditing(false)
18 {
19
20 }
21
22 ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget()
23 {
24   return ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(modelWidgets());
25 }
26
27 ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(
28                                                               const QList<ModuleBase_ModelWidget*>& theWidgets)
29 {
30   ModuleBase_ModelWidget* aFirstWidget = 0;
31
32   ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
33
34   ModuleBase_ModelWidget* aWgt;
35   QList<ModuleBase_ModelWidget*>::const_iterator aWIt;
36   bool isOffToolBox = false;
37   for (aWIt = theWidgets.begin(); aWIt != theWidgets.end() && !aFirstWidget; ++aWIt) {
38     aWgt = (*aWIt);
39     if (!aValidators->isCase(aWgt->feature(), aWgt->attributeID()))
40       continue; // this attribute is not participated in the current case
41
42     if (!aWgt->canSetValue())
43       continue;
44
45     /// workaround for the same attributes used in different stacked widgets(attribute types)
46     if (ModuleBase_ToolBox::isOffToolBoxParent(aWgt))
47       continue;
48
49     aFirstWidget = aWgt;
50   }
51   return aFirstWidget;
52 }