From b558b7c5638d5042b001beae78420f43742bcf86 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 29 Mar 2016 14:22:32 +0300 Subject: [PATCH] Issue #1368: Creation of a Qt panel. Widget creator interface correction to manage Qt panel type. --- src/ModuleBase/ModuleBase_IWidgetCreator.cpp | 18 ++++++++++++------ src/ModuleBase/ModuleBase_IWidgetCreator.h | 18 +++++++++--------- .../ModuleBase_WidgetCreatorFactory.cpp | 9 ++++++--- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp index 3daffa8bf..1ea485604 100755 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp @@ -10,17 +10,23 @@ ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() { } -const std::set& ModuleBase_IWidgetCreator::panelTypes() +QWidget* ModuleBase_IWidgetCreator::createPanelByType(const std::string& theType, + QWidget* theParent) { - return std::set(); + return 0; } -const std::set& ModuleBase_IWidgetCreator::pageTypes() +ModuleBase_PageBase* ModuleBase_IWidgetCreator::createPageByType(const std::string& theType, + QWidget* theParent, + Config_WidgetAPI* theWidgetApi) { - return std::set(); + return 0; } -const std::set& ModuleBase_IWidgetCreator::widgetTypes() +ModuleBase_ModelWidget* ModuleBase_IWidgetCreator::createWidgetByType(const std::string& theType, + QWidget* theParent, + Config_WidgetAPI* theWidgetApi, + ModuleBase_IWorkshop* theWorkshop) { - return std::set(); + return 0; } diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.h b/src/ModuleBase/ModuleBase_IWidgetCreator.h index 953d494c0..d27f5be82 100755 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.h +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.h @@ -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& panelTypes(); + /// \param theTypes a list of type names + virtual void panelTypes(std::set& theTypes) {} /// Returns a container of possible page types, which this creator can process - /// \returns list of type names - virtual const std::set& pageTypes(); + /// \param a list of type names + virtual void pageTypes(std::set& theTypes) {} /// Returns a container of possible widget types, which this creator can process - /// \returns list of type names - virtual const std::set& widgetTypes(); + /// \param a list of type names + virtual void widgetTypes(std::set& 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 WidgetCreatorPtr; diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp index 6fd77e061..2c5d6772b 100755 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp @@ -36,7 +36,8 @@ void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& th { std::set::const_iterator anIt, aLast; /// fill map of panels - const std::set& aPanelTypes = theCreator->panelTypes(); + std::set 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& aTypes = theCreator->widgetTypes(); + std::set 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& aPTypes = theCreator->pageTypes(); + std::set aPTypes; + theCreator->pageTypes(aPTypes); for (anIt = aPTypes.begin(), aLast = aPTypes.end(); anIt != aLast; anIt++) { std::string aKey = *anIt; if (!myPageToCreator.contains(aKey)) -- 2.39.2