]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1368: Creation of a Qt panel. Widget creator interface correction to manage...
authornds <nds@opencascade.com>
Tue, 29 Mar 2016 11:22:32 +0000 (14:22 +0300)
committernds <nds@opencascade.com>
Tue, 29 Mar 2016 11:22:32 +0000 (14:22 +0300)
src/ModuleBase/ModuleBase_IWidgetCreator.cpp
src/ModuleBase/ModuleBase_IWidgetCreator.h
src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp

index 3daffa8bf532e4ef505676edf0d3088c0f3e0ff5..1ea485604b2e71b4137679dd5c500bee9ad9e2ce 100755 (executable)
@@ -10,17 +10,23 @@ ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator()
 {
 }
 
-const std::set<std::string>& ModuleBase_IWidgetCreator::panelTypes()
+QWidget* ModuleBase_IWidgetCreator::createPanelByType(const std::string& theType,
+                                                      QWidget* theParent)
 {
-  return std::set<std::string>();
+  return 0;
 }
 
-const std::set<std::string>& ModuleBase_IWidgetCreator::pageTypes()
+ModuleBase_PageBase* ModuleBase_IWidgetCreator::createPageByType(const std::string& theType,
+                                                                 QWidget* theParent,
+                                                                 Config_WidgetAPI* theWidgetApi)
 {
-  return std::set<std::string>();
+  return 0;
 }
 
-const std::set<std::string>& ModuleBase_IWidgetCreator::widgetTypes()
+ModuleBase_ModelWidget* ModuleBase_IWidgetCreator::createWidgetByType(const std::string& theType,
+                                                                 QWidget* theParent,
+                                                                 Config_WidgetAPI* theWidgetApi,
+                                                                 ModuleBase_IWorkshop* theWorkshop)
 {
-  return std::set<std::string>();
+  return 0;
 }
index 953d494c0c7a8349663ebd18f21461979efa2ac5..d27f5be824bf2ce86db3239baf4c84ff8dd473ec 100755 (executable)
@@ -31,23 +31,23 @@ public:
   ~ModuleBase_IWidgetCreator();
 
   /// Returns a container of possible page types, which this creator can process
-  /// \returns list of type names
-  virtual const std::set<std::string>& panelTypes();
+  /// \param theTypes a list of type names
+  virtual void panelTypes(std::set<std::string>& theTypes) {}
 
   /// Returns a container of possible page types, which this creator can process
-  /// \returns list of type names
-  virtual const std::set<std::string>& pageTypes();
+  /// \param a list of type names
+  virtual void pageTypes(std::set<std::string>& theTypes) {}
 
   /// Returns a container of possible widget types, which this creator can process
-  /// \returns list of type names
-  virtual const std::set<std::string>& widgetTypes();
+  /// \param a list of type names
+  virtual void widgetTypes(std::set<std::string>& theTypes) {}
 
   /// Create panel control by its type.
   /// \param theType a panel type
   /// \param theParent a parent widget
   /// \return created widget or null
   virtual QWidget* createPanelByType(const std::string& theType,
-                                     QWidget* theParent) {};
+                                     QWidget* theParent);
 
   /// Create page by its type
   /// \param theType a type
@@ -55,7 +55,7 @@ public:
   /// \param theData a low-level API for reading xml definitions of widgets
   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
                                                 QWidget* theParent,
-                                                Config_WidgetAPI* theWidgetApi) {};
+                                                Config_WidgetAPI* theWidgetApi);
 
   /// Create widget by its type
   /// \param theType a type
@@ -64,7 +64,7 @@ public:
   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
                                                      QWidget* theParent,
                                                      Config_WidgetAPI* theWidgetApi,
-                                                     ModuleBase_IWorkshop* theWorkshop) {};
+                                                     ModuleBase_IWorkshop* theWorkshop);
 };
 
 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
index 6fd77e0615ccea862d6e9118f1ebe82c38f2ed4f..2c5d6772b0255af622839791c11317bff98b7582 100755 (executable)
@@ -36,7 +36,8 @@ void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& th
 {
   std::set<std::string>::const_iterator anIt, aLast;
   /// fill map of panels
-  const std::set<std::string>& aPanelTypes = theCreator->panelTypes();
+  std::set<std::string> aPanelTypes;
+  theCreator->panelTypes(aPanelTypes);
   for (anIt = aPanelTypes.begin(), aLast = aPanelTypes.end(); anIt != aLast; anIt++) {
     std::string aKey = *anIt;
     if (!myPanelToCreator.contains(aKey))
@@ -48,7 +49,8 @@ used by another widget creator");
   }
 
   /// fill map of widgets
-  const std::set<std::string>& aTypes = theCreator->widgetTypes();
+  std::set<std::string> aTypes;
+  theCreator->widgetTypes(aTypes);
   for (anIt = aTypes.begin(), aLast = aTypes.end(); anIt != aLast; anIt++) {
     std::string aKey = *anIt;
     if (!myCreators.contains(aKey))
@@ -60,7 +62,8 @@ used by another widget creator");
   }
 
   /// fill map of pages
-  const std::set<std::string>& aPTypes = theCreator->pageTypes();
+  std::set<std::string> aPTypes;
+  theCreator->pageTypes(aPTypes);
   for (anIt = aPTypes.begin(), aLast = aPTypes.end(); anIt != aLast; anIt++) {
     std::string aKey = *anIt;
     if (!myPageToCreator.contains(aKey))