#include <ModuleBase_WidgetFeature.h>
#include <ModuleBase_WidgetEditor.h>
#include <ModuleBase_WidgetSwitch.h>
#include <ModuleBase_WidgetFeature.h>
#include <ModuleBase_WidgetEditor.h>
#include <ModuleBase_WidgetSwitch.h>
#include <ModuleBase_WidgetDoubleValue.h>
#include <ModuleBase_WidgetBoolValue.h>
#include <ModuleBase_WidgetPoint2dDistance.h>
#include <ModuleBase_WidgetDoubleValue.h>
#include <ModuleBase_WidgetBoolValue.h>
#include <ModuleBase_WidgetPoint2dDistance.h>
ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
ModuleBase_IWorkshop* theWorkshop)
ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
ModuleBase_IWorkshop* theWorkshop)
if (!myWidgetApi->toChildWidget())
return;
QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent);
aWidgetLay->setContentsMargins(2, 2, 2, 2);
if (!myWidgetApi->toChildWidget())
return;
QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent);
aWidgetLay->setContentsMargins(2, 2, 2, 2);
std::string aWdgType = myWidgetApi->widgetType();
//Create a widget (doublevalue, groupbox, toolbox, etc.
QWidget* aWidget = createWidgetByType(aWdgType, theParent);
if (aWidget) {
if (!isInternalWidget(aWdgType)) {
aWidgetLay->addWidget(aWidget);
std::string aWdgType = myWidgetApi->widgetType();
//Create a widget (doublevalue, groupbox, toolbox, etc.
QWidget* aWidget = createWidgetByType(aWdgType, theParent);
if (aWidget) {
if (!isInternalWidget(aWdgType)) {
aWidgetLay->addWidget(aWidget);
if (aWdgType == WDG_SWITCH) {
ModuleBase_WidgetSwitch* aSwitch = qobject_cast<ModuleBase_WidgetSwitch*>(aWidget);
aSwitch->addPage(aPage, aPageName);
if (aWdgType == WDG_SWITCH) {
ModuleBase_WidgetSwitch* aSwitch = qobject_cast<ModuleBase_WidgetSwitch*>(aWidget);
aSwitch->addPage(aPage, aPageName);
QToolBox* aToolbox = qobject_cast<QToolBox*>(aWidget);
aToolbox->addItem(aPage, aPageName);
}
QToolBox* aToolbox = qobject_cast<QToolBox*>(aWidget);
aToolbox->addItem(aPage, aPageName);
}
- }
- else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
+ } else if (theType == WDG_FILE_SELECTOR) {
+ result = fileSelectorControl(theParent);
+
+ } else if (theType == WDG_CHOICE) {
+ result = choiceControl(theParent);
+
+ } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
- ModuleBase_WidgetDoubleValue* aDblWgt = new ModuleBase_WidgetDoubleValue(theParent, myWidgetApi);
+ ModuleBase_WidgetDoubleValue* aDblWgt =
+ new ModuleBase_WidgetDoubleValue(theParent, myWidgetApi, myParentId);
return aDblWgt->getControl();
}
QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent)
{
return aDblWgt->getControl();
}
QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent)
{
- ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, myWidgetApi);
+ ModuleBase_WidgetPoint2D* aWidget =
+ new ModuleBase_WidgetPoint2D(theParent, myWidgetApi,myParentId);
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::featureSelectorControl(QWidget* theParent)
{
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::featureSelectorControl(QWidget* theParent)
{
- ModuleBase_WidgetFeature* aWidget = new ModuleBase_WidgetFeature(theParent, myWidgetApi);
+ ModuleBase_WidgetFeature* aWidget =
+ new ModuleBase_WidgetFeature(theParent, myWidgetApi,myParentId);
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::featureOrAttributeSelectorControl(QWidget* theParent)
{
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::featureOrAttributeSelectorControl(QWidget* theParent)
{
- ModuleBase_WidgetFeatureOrAttribute* aWidget = new ModuleBase_WidgetFeatureOrAttribute(theParent,
- myWidgetApi);
+ ModuleBase_WidgetFeatureOrAttribute* aWidget =
+ new ModuleBase_WidgetFeatureOrAttribute(theParent, myWidgetApi, myParentId);
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::doubleValueEditor(QWidget* theParent)
{
myModelWidgets.append(aWidget);
return aWidget->getControl();
}
QWidget* ModuleBase_WidgetFactory::doubleValueEditor(QWidget* theParent)
{
- ModuleBase_WidgetEditor* aWidget = new ModuleBase_WidgetEditor(theParent, myWidgetApi);
+ ModuleBase_WidgetEditor* aWidget =
+ new ModuleBase_WidgetEditor(theParent, myWidgetApi, myParentId);
- return QString::fromStdString(theStdString);
+ ModuleBase_WidgetShapeSelector* aSelector =
+ new ModuleBase_WidgetShapeSelector(theParent, myWorkshop, myWidgetApi, myParentId);
+ myModelWidgets.append(aSelector);
+ return aSelector->getControl();
- std::string prop = myWidgetApi->getProperty(FEATURE_INTERNAL);
+ ModuleBase_WidgetBoolValue* aBoolWgt =
+ new ModuleBase_WidgetBoolValue(theParent, myWidgetApi, myParentId);
+ myModelWidgets.append(aBoolWgt);
+ return aBoolWgt->getControl();
+}
- std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
- if(prop.empty() || prop == "false" || prop == "0") {
- return false;
- }
- return true;
+QWidget* ModuleBase_WidgetFactory::point2dDistanceControl(QWidget* theParent)
+{
+ ModuleBase_WidgetPoint2dDistance* aDistWgt =
+ new ModuleBase_WidgetPoint2dDistance(theParent, myWidgetApi, myParentId);
+ myModelWidgets.append(aDistWgt);
+ return aDistWgt->getControl();
- ModuleBase_WidgetSelector* aSelector = new ModuleBase_WidgetSelector(theParent, myWorkshop, myWidgetApi);
- myModelWidgets.append(aSelector);
- return aSelector->getControl();
+ ModuleBase_WidgetFileSelector* aFileSelectorWgt =
+ new ModuleBase_WidgetFileSelector(theParent, myWidgetApi, myParentId);
+ myModelWidgets.append(aFileSelectorWgt);
+ return aFileSelectorWgt->getControl();
+QWidget* ModuleBase_WidgetFactory::choiceControl(QWidget* theParent)
+{
+ ModuleBase_WidgetChoice* aChoiceWgt =
+ new ModuleBase_WidgetChoice(theParent, myWidgetApi,myParentId);
+ myModelWidgets.append(aChoiceWgt);
+ return aChoiceWgt->getControl();
+}
- return aBoolWgt->getControl();
+ std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
+ if (prop.empty() || prop == "false" || prop == "0") {
+ return false;
+ }
+ return true;
- ModuleBase_WidgetPoint2dDistance* aDistWgt = new ModuleBase_WidgetPoint2dDistance(theParent, myWidgetApi);
- myModelWidgets.append(aDistWgt);
-
- return aDistWgt->getControl();
-}
\ No newline at end of file
+ return QString::fromStdString(theStdString);
+}