]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Tue, 24 Jun 2014 10:25:50 +0000 (14:25 +0400)
committernds <natalia.donis@opencascade.com>
Tue, 24 Jun 2014 10:25:50 +0000 (14:25 +0400)
Hide internal widgets.

src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/SketchPlugin/plugin-Sketch.xml

index 0ced5bb8b19d290b6a087414eb838b90d85f2267..e122c52504b6633feb7e573e8ed2d885b91899ed 100644 (file)
@@ -61,7 +61,11 @@ void ModuleBase_WidgetFactory::createWidget(QWidget* theParent)
     //Create a widget (doublevalue, groupbox, toolbox, etc.
     QWidget* aWidget = createWidgetByType(aWdgType, theParent);
     if (aWidget) {
-      aWidgetLay->addWidget(aWidget);
+      if (!isInternalWidget(aWdgType)) {
+        aWidgetLay->addWidget(aWidget);
+      }
+      else
+        aWidget->setVisible(false);
     }
     if (myWidgetApi->isContainerWidget()) {
       //if current widget is groupbox (container) process it's children recursively
@@ -195,6 +199,16 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
   return QString::fromStdString(theStdString);
 }
 
+bool ModuleBase_WidgetFactory::isInternalWidget(const std::string& theType)
+{
+  std::string prop = myWidgetApi->getProperty(FEATURE_INTERNAL);
+
+  std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
+  if(prop.empty() || prop == "false" || prop == "0") {
+    return false;
+  }
+  return true; 
+}
 
 QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent)
 {
index 3493028c5ee40d07748fb3a84e23f836b12a3617..b29fba9eb6543470af9724e800c6dfb147410f09 100644 (file)
@@ -45,6 +45,11 @@ protected:
   QWidget* booleanControl(QWidget* theParent);
   QWidget* point2dDistanceControl(QWidget* theParent);
 
+  /// Check whether the XML definition for the given type contains internal property
+  /// \param theType the widget type
+  /// \return the boolean result
+  bool isInternalWidget(const std::string& theType);
+
   QString qs(const std::string& theStdString) const;
 
 private:
index 5b1dcf60025528155b3bfb5c46856ed9508c25b7..c741ab09ca8d1828b91cccda0e611d7753035811 100644 (file)
@@ -24,9 +24,9 @@
       <feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
       <feature id="SketchConstraintDistance" title="Distance between objects" tooltip="Create constraint for the distance from a point to an object">
         <label title="Select point and another feature (point or point on line) between which to calculate distance" tooltip="Select point and another feature (point or point on line) between which to calculate distance"/>
-        <feature_selector id="ConstraintEntityA" keysequence="SketchPoint"/>
-        <feature_selector id="ConstraintEntityB" keysequence="SketchPoint"/>
-        <point_selector id="ConstraintFlyoutValuePnt" title="Flyout point" tooltip="Flyout"/>
+        <feature_selector id="ConstraintEntityA" keysequence="SketchPoint" internal="1"/>
+        <feature_selector id="ConstraintEntityB" keysequence="SketchPoint" internal="1"/>
+        <point_selector id="ConstraintFlyoutValuePnt" title="Flyout point" tooltip="Flyout" internal="1"/>
         <doublevalue_editor id="ConstraintValue" min="0" step="1.0" tooltip="Constraint value"/>
       </feature>
       <feature id="SketchConstraintLength" title="Length of a line" tooltip="Create constraint for the given length of a line segment">