X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_WidgetFactory.cpp;h=1ef8c83d8bedc66cea3b12e801dd69b0ee4d303c;hb=a25996a80f13f4af8bd60a90edc3811bbbee3b2d;hp=e5212c7e85f70d8d4f61cf562f204976ca77dfd3;hpb=950f8c3ca4de26c84757fe06698d8ea5a527757a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index e5212c7e8..1ef8c83d8 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #ifdef _DEBUG #include @@ -104,13 +107,20 @@ QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType QWidget* result = NULL; if (theType == WDG_DOUBLEVALUE) { result = doubleSpinBoxControl(); + } else if (theType == WDG_INFO) { result = labelControl(theParent); - } - else if (theType == WDG_POINT_SELECTOR) { + + } else if (theType == WDG_SELECTOR) { + result = selectorControl(theParent); + + } else if (theType == WDG_BOOLVALUE) { + result = booleanControl(theParent); + + } else if (theType == WDG_POINT_SELECTOR) { result = pointSelectorControl(theParent); - } - else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { + + } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { result = createContainer(theType, theParent); } #ifdef _DEBUG @@ -215,3 +225,44 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const { return QString::fromStdString(theStdString); } + + +QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent) +{ + QWidget* aRes = new QWidget(); + QHBoxLayout* aLayout = new QHBoxLayout(aRes); + + aLayout->setContentsMargins(0, 0, 0, 0); + QString aLabelText = qs(myWidgetApi->widgetLabel()); + QString aLabelIcon = qs(myWidgetApi->widgetIcon()); + QLabel* aLabel = new QLabel(aLabelText, aRes); + aLabel->setPixmap(QPixmap(aLabelIcon)); + + aLayout->addWidget(aLabel); + + QLineEdit* aTextLine = new QLineEdit(aRes); + aTextLine->setReadOnly(true); + + aLayout->addWidget(aTextLine); + + QToolButton* aActivateBtn = new QToolButton(aRes); + aActivateBtn->setIcon(QIcon(":icons/hand_point.png")); + aActivateBtn->setCheckable(true); + + aLayout->addWidget(aActivateBtn); + + return aRes; +} + + +QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent) +{ + QString aText = qs(myWidgetApi->widgetLabel()); + QString aToolTip = qs(myWidgetApi->widgetTooltip()); + QString aDefault = qs(myWidgetApi->getProperty("default")); + + QCheckBox* aRes = new QCheckBox(aText, theParent); + aRes->setToolTip(aToolTip); + aRes->setChecked(aDefault == "true"); + return aRes; +} \ No newline at end of file