From: sbh Date: Thu, 24 Apr 2014 14:24:27 +0000 (+0400) Subject: Label for the sketch widget + label's xml processing X-Git-Tag: V_0.2~118^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=74e4557af4662a5fe7f93892840c8db5bd47c356;p=modules%2Fshaper.git Label for the sketch widget + label's xml processing --- diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index f5bfe19e8..6c8f91835 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -19,6 +19,7 @@ const static char* NODE_SOURCE = "source"; //Widgets const static char* WDG_DOUBLEVALUE = "doublevalue"; //Widget containers +const static char* WDG_INFO = "label"; const static char* WDG_GROUP = "groupbox"; const static char* WDG_CHECK_GROUP = "check_groupbox"; const static char* WDG_TOOLBOX = "toolbox"; @@ -38,6 +39,8 @@ const static char* SOURCE_FILE = "path"; // doublevalue properties: +const static char* INFO_WDG_TEXT = FEATURE_TEXT; +const static char* INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; const static char* DOUBLE_WDG_MIN = "min"; const static char* DOUBLE_WDG_MAX = "max"; const static char* DOUBLE_WDG_STEP = "step"; diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 03f85d087..09ac545be 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -1,7 +1,10 @@ - + + diff --git a/src/XGUI/XGUI_WidgetFactory.cpp b/src/XGUI/XGUI_WidgetFactory.cpp index 929f71771..17c3ab6c3 100644 --- a/src/XGUI/XGUI_WidgetFactory.cpp +++ b/src/XGUI/XGUI_WidgetFactory.cpp @@ -82,11 +82,26 @@ void XGUI_WidgetFactory::createWidget(QWidget* theParent) theParent->setLayout(aWidgetLay); } +QWidget* XGUI_WidgetFactory::labelControl(QWidget* theParent) +{ + QWidget* result = new QWidget(theParent); + QVBoxLayout* aLabelLay = new QVBoxLayout(result); + QLabel* aLabel = new QLabel(result); + aLabel->setText(qs(myWidgetApi->getProperty(INFO_WDG_TEXT))); + aLabel->setToolTip(qs(myWidgetApi->getProperty(INFO_WDG_TOOLTIP))); + aLabelLay->addWidget(aLabel); + aLabelLay->addStretch(1); + result->setLayout(aLabelLay); + return result; +} + QWidget* XGUI_WidgetFactory::createWidgetByType(const std::string& theType, QWidget* theParent) { QWidget* result = NULL; if (theType == WDG_DOUBLEVALUE) { result = doubleSpinBoxControl(); + } else if (theType == WDG_INFO) { + result = labelControl(theParent); } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { result = createContainer(theType, theParent); } diff --git a/src/XGUI/XGUI_WidgetFactory.h b/src/XGUI/XGUI_WidgetFactory.h index ed0ba16c6..d83d8fbb4 100644 --- a/src/XGUI/XGUI_WidgetFactory.h +++ b/src/XGUI/XGUI_WidgetFactory.h @@ -25,11 +25,12 @@ public: protected: //Widgets - QWidget* doubleSpinBoxControl(); QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL); + QWidget* labelControl(QWidget* theParent); + QWidget* doubleSpinBoxControl(); QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL); - bool connectWidget(QWidget*, const QString&); + bool connectWidget(QWidget*, const QString&); QString qs(const std::string& theStdString) const; private: