#include <cfloat>
#include <climits>
-ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(ModuleBase_Operation* theOperation, ModuleBase_IWorkshop* theWorkshop)
- : myOperation(theOperation), myWorkshop(theWorkshop)
+ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
+ ModuleBase_IWorkshop* theWorkshop)
+ : myWorkshop(theWorkshop)
{
- QString aXml = myOperation->getDescription()->xmlRepresentation();
- myWidgetApi = new Config_WidgetAPI(aXml.toStdString());
+ myWidgetApi = new Config_WidgetAPI(theXmlRepresentation);
}
ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory()
QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
{
ModuleBase_WidgetDoubleValue* aDblWgt = new ModuleBase_WidgetDoubleValue(theParent, myWidgetApi);
- QObject::connect(aDblWgt, SIGNAL(valuesChanged()), myOperation, SLOT(storeCustomValue()));
-
myModelWidgets.append(aDblWgt);
return aDblWgt->getControl();
QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent)
{
ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, myWidgetApi);
- QObject::connect(aWidget, SIGNAL(valuesChanged()), myOperation, SLOT(storeCustomValue()));
-
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent)
{
ModuleBase_WidgetSelector* aSelector = new ModuleBase_WidgetSelector(theParent, myWorkshop, myWidgetApi);
-
- QObject::connect(aSelector, SIGNAL(valuesChanged()), myOperation, SLOT(storeCustomValue()));
-
myModelWidgets.append(aSelector);
return aSelector->getControl();
}
QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent)
{
ModuleBase_WidgetBoolValue* aBoolWgt = new ModuleBase_WidgetBoolValue(theParent, myWidgetApi);
- QObject::connect(aBoolWgt, SIGNAL(valuesChanged()), myOperation, SLOT(storeCustomValue()));
-
myModelWidgets.append(aBoolWgt);
return aBoolWgt->getControl();
class QObject;
class QWidget;
class Config_WidgetAPI;
-class ModuleBase_Operation;
class ModuleBase_IWorkshop;
class MODULEBASE_EXPORT ModuleBase_WidgetFactory
{
public:
- ModuleBase_WidgetFactory(ModuleBase_Operation* theOperation, ModuleBase_IWorkshop* theWorkshop);
+ ModuleBase_WidgetFactory(const std::string& theXmlRepresentation, ModuleBase_IWorkshop* theWorkshop);
virtual ~ModuleBase_WidgetFactory();
void createWidget(QWidget* theParent);
private:
Config_WidgetAPI* myWidgetApi;
- ModuleBase_Operation* myOperation;
ModuleBase_IWorkshop* myWorkshop;
QList<ModuleBase_ModelWidget*> myModelWidgets;
showPropertyPanel();
- ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation, myModuleConnector);
+ QString aXmlRepr = aOperation->getDescription()->xmlRepresentation();
+ ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(), myModuleConnector);
QWidget* aContent = myPropertyPanel->contentWidget();
qDeleteAll(aContent->children());
aFactory.createWidget(aContent);
- // Init default values
- if (!aOperation->isEditOperation()) {
- QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
- QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
- for (; anIt != aLast; anIt++) {
- (*anIt)->storeValue(aOperation->feature());
+ QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
+ QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
+ ModuleBase_ModelWidget* aWidget;
+ for (; anIt != aLast; anIt++) {
+ aWidget = *anIt;
+ QObject::connect(aWidget, SIGNAL(valuesChanged()), aOperation, SLOT(storeCustomValue()));
+ // Init default values
+ if (!aOperation->isEditOperation()) {
+ aWidget->storeValue(aOperation->feature());
}
}