]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Label for the sketch widget + label's xml processing
authorsbh <sergey.belash@opencascade.com>
Thu, 24 Apr 2014 14:24:27 +0000 (18:24 +0400)
committersbh <sergey.belash@opencascade.com>
Thu, 24 Apr 2014 14:24:27 +0000 (18:24 +0400)
src/Config/Config_Keywords.h
src/SketchPlugin/plugin-Sketch.xml
src/XGUI/XGUI_WidgetFactory.cpp
src/XGUI/XGUI_WidgetFactory.h

index f5bfe19e80d16a2929efa6b9181370957503a6d9..6c8f91835460e5464b9d830424bff0e40458c6a3 100644 (file)
@@ -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";
index 03f85d0875646f55e335221a35340fda58d2c07b..09ac545be2f24fc6de3dd31a06b516a68cda2b50 100644 (file)
@@ -1,7 +1,10 @@
 <plugin>
   <workbench id="Sketch">
     <group id="Basic">
-      <feature id="Sketch" text="New sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png"/>
+      <feature id="Sketch" text="New sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+        <label text="Natasha, please provide a text for the label" tooltip="Natasha, please provide a text for the tooltip"/> 
+      <!--icon=":pictures/x_point.png"-->
+      </feature>
     </group>
   </workbench>
 </plugin>
index 929f71771e761a342d9184d38cd3615eb39fc53c..17c3ab6c3dc196ad4533dd7a64b0f0badec8a105 100644 (file)
@@ -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);
   }
index ed0ba16c6ab76077bff23e23c20cfe2cdd84c4e2..d83d8fbb4b61c09063323733e3656542187e7bf5 100644 (file)
@@ -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: