Salome HOME
Avoid automatic closing of Placement operation
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 3 Dec 2014 14:59:38 +0000 (17:59 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 3 Dec 2014 14:59:38 +0000 (17:59 +0300)
src/FeaturesPlugin/placement_widget.xml
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/ModuleBase/ModuleBase_WidgetLabel.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetLabel.h [new file with mode: 0644]

index 998b27258c5286ee3eec8b4811c37d4537446310..0e6f3488ed79e275bba215df08f93b21c30151e1 100644 (file)
@@ -12,5 +12,8 @@
     tooltip="Select a face of another object"
     shape_types="face"
     use_subshapes="true"
+       concealment="true"
   />
+  <!-- In order to avoid automatic closing of operation -->
+  <label id="" label="" internal="1"/>
 </source>
index a8c1cbd263b7846f8265c82dcfc55e8a80841412..394f67673b034285a02565742f36c04bd4b0064b 100644 (file)
@@ -12,8 +12,6 @@ SET(PROJECT_HEADERS
        ModuleBase_WidgetDoubleValue.h
        ModuleBase_WidgetEditor.h
        ModuleBase_WidgetFactory.h
-#      ModuleBase_WidgetFeature.h
-#      ModuleBase_WidgetFeatureOrAttribute.h
        ModuleBase_WidgetSwitch.h
        ModuleBase_WidgetShapeSelector.h
        ModuleBase_IWorkshop.h
@@ -33,6 +31,7 @@ SET(PROJECT_HEADERS
        ModuleBase_ViewerFilters.h
        ModuleBase_ResultPrs.h
        ModuleBase_IViewWindow.h
+       ModuleBase_WidgetLabel.h
 )
 
 SET(PROJECT_SOURCES
@@ -45,8 +44,6 @@ SET(PROJECT_SOURCES
        ModuleBase_WidgetDoubleValue.cpp
        ModuleBase_WidgetEditor.cpp
        ModuleBase_WidgetFactory.cpp
-#      ModuleBase_WidgetFeature.cpp
-#      ModuleBase_WidgetFeatureOrAttribute.cpp
        ModuleBase_WidgetSwitch.cpp
        ModuleBase_WidgetShapeSelector.cpp
        ModuleBase_WidgetValue.cpp
@@ -58,6 +55,7 @@ SET(PROJECT_SOURCES
        ModuleBase_WidgetMultiSelector.cpp
        ModuleBase_ViewerFilters.cpp
        ModuleBase_ResultPrs.cpp
+       ModuleBase_WidgetLabel.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 66bc824f4ecb8a3c25dd5911e416bbb6db473a24..d000e87e090771aaf7e268dfe68deaa435f2d78d 100644 (file)
@@ -24,6 +24,7 @@
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_WidgetLineEdit.h>
 #include <ModuleBase_WidgetMultiSelector.h>
+#include <ModuleBase_WidgetLabel.h>
 
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Session.h>
@@ -108,20 +109,16 @@ void ModuleBase_WidgetFactory::createWidget(QWidget* theParent)
   theParent->setLayout(aWidgetLay);
 }
 
+
 QWidget* ModuleBase_WidgetFactory::labelControl(QWidget* theParent)
 {
-  QWidget* result = new QWidget(theParent);
-  QVBoxLayout* aLabelLay = new QVBoxLayout(result);
-  QLabel* aLabel = new QLabel(result);
-  aLabel->setWordWrap(true);
-  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;
+  ModuleBase_WidgetLabel* aWgt =
+      new ModuleBase_WidgetLabel(theParent, myWidgetApi, myParentId);
+  myModelWidgets.append(aWgt);
+  return aWgt->getControl();
 }
 
+
 QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType,
                                                       QWidget* theParent)
 {
@@ -199,22 +196,6 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
   return aDblWgt->getControl();
 }
 
-//QWidget* ModuleBase_WidgetFactory::featureSelectorControl(QWidget* theParent)
-//{
-//  ModuleBase_WidgetFeature* aWidget =
-//      new ModuleBase_WidgetFeature(theParent, myWidgetApi,myParentId);
-//  myModelWidgets.append(aWidget);
-//  return aWidget->getControl();
-//}
-
-//QWidget* ModuleBase_WidgetFactory::featureOrAttributeSelectorControl(QWidget* theParent)
-//{
-//  ModuleBase_WidgetFeatureOrAttribute* aWidget =
-//      new ModuleBase_WidgetFeatureOrAttribute(theParent, myWidgetApi, myParentId);
-//  myModelWidgets.append(aWidget);
-//  return aWidget->getControl();
-//}
-
 QWidget* ModuleBase_WidgetFactory::doubleValueEditor(QWidget* theParent)
 {
   ModuleBase_WidgetEditor* aWidget =
@@ -275,3 +256,4 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
 {
   return QString::fromStdString(theStdString);
 }
+
index 7d40f5b7215f1d1ee8667ac2fc1b424d16eba615..581e67cbaa234a5a61d016d84ab10ea53c44a153 100644 (file)
@@ -39,8 +39,6 @@ class MODULEBASE_EXPORT ModuleBase_WidgetFactory
   QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL);
   QWidget* labelControl(QWidget* theParent);
   QWidget* doubleSpinBoxControl(QWidget* theParent);
-  //QWidget* featureSelectorControl(QWidget* theParent);
-  //QWidget* featureOrAttributeSelectorControl(QWidget* theParent);
   QWidget* doubleValueEditor(QWidget* theParent);
   QWidget* shapeSelectorControl(QWidget* theParent);
   QWidget* booleanControl(QWidget* theParent);
diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp
new file mode 100644 (file)
index 0000000..e5b090b
--- /dev/null
@@ -0,0 +1,35 @@
+// File:        ModuleBase_WidgetLabel.cpp
+// Created:     03 Dec 2014
+// Author:      Vitaly SMETANNIKOV
+
+#include "ModuleBase_WidgetLabel.h"
+
+#include <Config_WidgetAPI.h>
+
+#include <QLabel>
+
+
+ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent,
+                                                     const Config_WidgetAPI* theData,
+                                                     const std::string& theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
+{
+  QString aText = QString::fromStdString(theData->getProperty("title"));
+  myLabel = new QLabel(aText, theParent);
+  myLabel->setWordWrap(true);
+  myLabel->setIndent(5);
+}
+
+ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel()
+{
+}
+
+QList<QWidget*> ModuleBase_WidgetLabel::getControls() const
+{
+  return QList<QWidget*>();
+}
+
+QWidget* ModuleBase_WidgetLabel::getControl() const
+{
+  return myLabel;
+}
diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h
new file mode 100644 (file)
index 0000000..f751139
--- /dev/null
@@ -0,0 +1,40 @@
+// File:        ModuleBase_WidgetLabel.h
+// Created:     03 Dec 2014
+// Author:      Vitaly SMETANNIKOV
+
+#ifndef ModuleBase_WidgetLabel_H
+#define ModuleBase_WidgetLabel_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_ModelWidget.h"
+
+class QLabel;
+
+class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget
+{
+Q_OBJECT
+ public:
+  ModuleBase_WidgetLabel(QWidget* theParent, const Config_WidgetAPI* theData,
+                            const std::string& theParentId);
+
+  virtual ~ModuleBase_WidgetLabel();
+
+  virtual bool storeValue() const
+  {
+    return true;
+  }
+
+  virtual bool restoreValue()
+  {
+    return true;
+  }
+
+  virtual QList<QWidget*> getControls() const;
+
+  QWidget* getControl() const;
+
+private:
+  QLabel* myLabel;
+};
+
+#endif
\ No newline at end of file