From 4d6a5c7e00c6d8e68c01ce5947432d9cdfbcb7a5 Mon Sep 17 00:00:00 2001 From: sbh Date: Thu, 17 Apr 2014 16:11:14 +0400 Subject: [PATCH] Container widgets processing for the PropertyPanel added --- src/Config/CMakeLists.txt | 1 + src/Config/Config_Common.h | 81 ++++++++++++++++++ src/Config/Config_FeatureReader.cpp | 1 + src/Config/Config_Keywords.h | 15 +++- src/Config/Config_ModuleReader.cpp | 1 + src/Config/Config_WidgetAPI.cpp | 73 +++++++++------- src/Config/Config_WidgetAPI.h | 10 +-- src/Config/Config_WidgetReader.cpp | 1 + src/Config/Config_XMLReader.cpp | 45 ---------- src/Config/Config_XMLReader.h | 8 -- src/XGUI/CMakeLists.txt | 2 + src/XGUI/XGUI_SwitchWidget.cpp | 125 ++++++++++++++++++++++++++++ src/XGUI/XGUI_SwitchWidget.h | 53 ++++++++++++ src/XGUI/XGUI_WidgetFactory.cpp | 96 ++++++++++++++++----- src/XGUI/XGUI_WidgetFactory.h | 12 ++- src/XGUI/XGUI_Workshop.cpp | 2 +- 16 files changed, 409 insertions(+), 117 deletions(-) create mode 100644 src/Config/Config_Common.h create mode 100644 src/XGUI/XGUI_SwitchWidget.cpp create mode 100644 src/XGUI/XGUI_SwitchWidget.h diff --git a/src/Config/CMakeLists.txt b/src/Config/CMakeLists.txt index f4f98b9d7..660990d30 100644 --- a/src/Config/CMakeLists.txt +++ b/src/Config/CMakeLists.txt @@ -12,6 +12,7 @@ SET(PROJECT_HEADERS Config_WidgetAPI.h Config_WidgetReader.h Config_PointerMessage.h + Config_Common.h ) SET(PROJECT_SOURCES diff --git a/src/Config/Config_Common.h b/src/Config/Config_Common.h new file mode 100644 index 000000000..b4e2e5f5a --- /dev/null +++ b/src/Config/Config_Common.h @@ -0,0 +1,81 @@ +/* + * Config_Common.h + * + * Created on: Apr 17, 2014 + * Author: sbh + */ + +#include +#include + +//>> Forward declaration of xmlNodePtr. +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; +struct _xmlNode; +//<< + +//>> Forward declaration of xmlDocPtr. +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc *xmlDocPtr; +struct _xmlDoc; +//<< + +/* + * Returns true if theNode is XML ELEMENT node (not a "text" node ie). + */ +static bool isElementNode(xmlNodePtr theNode) +{ + return theNode->type == XML_ELEMENT_NODE; +} + +/* + * Returns true if theNode is XML node with a given name. + + * Please note that this function should be called with NULL last argument. + * In example: isNode(aNode, "type1", ["type2", ...], NULL); + * ", NULL" is required to use unlimited number of arguments. + * TODO(sbh): find a way to simplify calling this method. + */ +static bool isNode(xmlNodePtr theNode, const char* theNodeName, ...) +{ + bool result = false; + const xmlChar* aName = theNode->name; + if (!aName || !isElementNode(theNode)) { + return false; + } + if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) { + return true; + } + va_list args; // define argument list variable + va_start(args, theNodeName); // init list; point to last defined argument + while(true) { + char *anArg = va_arg (args, char*); // get next argument + if (anArg == NULL) + break; + if (!xmlStrcmp(aName, (const xmlChar *) anArg)) { + va_end(args); // cleanup the system stack + return true; + } + } + va_end(args); // cleanup the system stack + return false; +} + + +/* + * Every xml node has child. Even if there is no explicit + * child nodes libxml gives the "Text node" as child. + * + * This method checks if real child nodes exist in the + * given node. + */ +static bool hasChild(xmlNodePtr theNode) +{ + xmlNodePtr aNode = theNode->children; + for(; aNode; aNode = aNode->next) { + if (isElementNode(theNode)) { + return true; + } + } + return false; +} diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index ddefe6df2..bb52b413f 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index bd589d92d..3c7bb936c 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -14,7 +14,16 @@ const static char* NODE_WORKBENCH = "workbench"; const static char* NODE_GROUP = "group"; const static char* NODE_FEATURE = "feature"; -const static char* NODE_DOUBLE_WDG = "doublevalue"; +//Widgets +const static char* WDG_DOUBLEVALUE = "doublevalue"; +//Widget containers +const static char* WDG_GROUP = "groupbox"; +const static char* WDG_CHECK_GROUP = "check_groupbox"; +const static char* WDG_TOOLBOX = "toolbox"; +const static char* WDG_TOOLBOX_BOX = "box"; +const static char* WDG_SWITCH = "switch"; +const static char* WDG_SWITCH_CASE = "case"; + const static char* _ID = "id"; //const static char* WORKBENCH_ID = "id"; @@ -31,6 +40,10 @@ const static char* DOUBLE_WDG_MAX = "max"; const static char* DOUBLE_WDG_STEP = "step"; const static char* DOUBLE_WDG_DFLT = "default"; +//toolbox/switch properties +const static char* CONTAINER_PAGE_NAME = "title"; + + /* * Hardcoded xml entities of plugins.xml */ diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index 4fbc7d98b..6153bd04d 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include diff --git a/src/Config/Config_WidgetAPI.cpp b/src/Config/Config_WidgetAPI.cpp index 80eb56811..9a77d778a 100644 --- a/src/Config/Config_WidgetAPI.cpp +++ b/src/Config/Config_WidgetAPI.cpp @@ -6,6 +6,8 @@ */ #include +#include +#include #include #include @@ -14,7 +16,7 @@ Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml) { myDoc = xmlParseDoc(BAD_CAST theRawXml.c_str()); - myCurrentNode = NULL; + myCurrentNode = xmlDocGetRootElement(myDoc); } @@ -23,18 +25,38 @@ Config_WidgetAPI::~Config_WidgetAPI() xmlFreeDoc(myDoc); } -void Config_WidgetAPI::reset() +bool Config_WidgetAPI::toNextWidget() { - xmlNodePtr aRoot = xmlDocGetRootElement(myDoc); - if(aRoot) { - myCurrentNode = aRoot->children; + //Skip all non-element node, stop if next node is null + xmlNodePtr aNextNode = myCurrentNode; + do { + aNextNode = aNextNode->next; + } while(aNextNode && !isElementNode(aNextNode)); + + if(!aNextNode) { + toParentWidget(); + return false; } + myCurrentNode = aNextNode; + return true; } -bool Config_WidgetAPI::nextWidget() +bool Config_WidgetAPI::toChildWidget() +{ + if(myCurrentNode && hasChild(myCurrentNode)) { + myCurrentNode = myCurrentNode->children; + while(!isElementNode(myCurrentNode)) { + myCurrentNode = myCurrentNode->next; + } + return true; + } + return false; +} + +bool Config_WidgetAPI::toParentWidget() { if(myCurrentNode) { - myCurrentNode = myCurrentNode->next; + myCurrentNode = myCurrentNode->parent; } return myCurrentNode != NULL; } @@ -48,6 +70,18 @@ std::string Config_WidgetAPI::widgetType() return result; } +bool Config_WidgetAPI::isContainerWidget() +{ + return isNode(myCurrentNode, WDG_GROUP, WDG_CHECK_GROUP, + NULL); +} + +bool Config_WidgetAPI::isPagedWidget() +{ + return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, + NULL); +} + std::string Config_WidgetAPI::getProperty(const char* thePropName) { std::string result = ""; @@ -77,28 +111,3 @@ std::string Config_WidgetAPI::widgetLabel() { return getProperty("label"); } - -bool Config_WidgetAPI::isNode(xmlNodePtr theNode, const char* theNodeName, ...) -{ - bool result = false; - const xmlChar* aName = theNode->name; - if (!aName || theNode->type != XML_ELEMENT_NODE) - return false; - - if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) - return true; - - va_list args; // define argument list variable - va_start(args, theNodeName); // init list; point to last defined argument - while(true) { - char *anArg = va_arg (args, char*); // get next argument - if (anArg == NULL) - break; - if (!xmlStrcmp(aName, (const xmlChar *) anArg)) { - va_end(args); // cleanup the system stack - return true; - } - } - va_end(args); // cleanup the system stack - return false; -} diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index c98888f12..4030ff257 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -32,10 +32,13 @@ public: Config_WidgetAPI(std::string theRawXml); virtual ~Config_WidgetAPI(); - void reset(); - bool nextWidget(); + bool toNextWidget(); + bool toChildWidget(); + bool toParentWidget(); std::string widgetType(); + bool isContainerWidget(); + bool isPagedWidget(); std::string widgetId(); std::string widgetIcon(); @@ -44,9 +47,6 @@ public: std::string getProperty(const char* thePropName); -protected: - bool isNode(xmlNodePtr theNode, const char* name, ...); - private: xmlDocPtr myDoc; xmlNodePtr myCurrentNode; diff --git a/src/Config/Config_WidgetReader.cpp b/src/Config/Config_WidgetReader.cpp index 032acb000..d78539982 100644 --- a/src/Config/Config_WidgetReader.cpp +++ b/src/Config/Config_WidgetReader.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 085871fdd..002c9df49 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -141,48 +141,3 @@ std::string Config_XMLReader::getProperty(xmlNodePtr theNode, const char* name) return result; } -/* - * Returns true if theNode is XML node with a given name. - */ -bool Config_XMLReader::isNode(xmlNodePtr theNode, const char* theNodeName, ...) -{ - bool result = false; - const xmlChar* aName = theNode->name; - if (!aName || theNode->type != XML_ELEMENT_NODE) { - return false; - } - if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) { - return true; - } - va_list args; // define argument list variable - va_start(args, theNodeName); // init list; point to last defined argument - while(true) { - char *anArg = va_arg (args, char*); // get next argument - if (anArg == NULL) - break; - if (!xmlStrcmp(aName, (const xmlChar *) anArg)) { - va_end(args); // cleanup the system stack - return true; - } - } - va_end(args); // cleanup the system stack - return false; -} - -/* - * Every xml node has child. Even if there is no explicit - * child nodes libxml gives the "Text node" as child. - * - * This method checks if real child nodes exist in the - * given node. - */ -bool Config_XMLReader::hasChild(xmlNodePtr theNode) -{ - xmlNodePtr aNode = theNode->children; - for(; aNode; aNode = aNode->next) { - if (aNode->type != XML_ELEMENT_NODE) { - return true; - } - } - return false; -} diff --git a/src/Config/Config_XMLReader.h b/src/Config/Config_XMLReader.h index 95d3ea651..a44d49364 100644 --- a/src/Config/Config_XMLReader.h +++ b/src/Config/Config_XMLReader.h @@ -47,14 +47,6 @@ protected: xmlNodePtr node(void* theNode); std::string getProperty(xmlNodePtr theNode, const char* property); - /* - * Please note that this function should be called with NULL last argument. - * In example: isNode(aNode, "type1", ["type2", ...], NULL); - * ", NULL" is required to use unlimited number of arguments. - * TODO(sbh): find a way to simplify calling this method. - */ - bool isNode(xmlNodePtr theNode, const char* name, ...); - bool hasChild(xmlNodePtr theNode); protected: std::string myDocumentPath; diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index c77c1ce44..a10e48e68 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -23,6 +23,7 @@ SET(PROJECT_HEADERS XGUI_ObjectsBrowser.h XGUI_DataTreeModel.h XGUI_SelectionMgr.h + XGUI_SwitchWidget.h ) SET(PROJECT_AUTOMOC @@ -47,6 +48,7 @@ SET(PROJECT_SOURCES XGUI_PartDataModel.cpp XGUI_ObjectsBrowser.cpp XGUI_SelectionMgr.cpp + XGUI_SwitchWidget.cpp ) SET(PROJECT_RESOURCES diff --git a/src/XGUI/XGUI_SwitchWidget.cpp b/src/XGUI/XGUI_SwitchWidget.cpp new file mode 100644 index 000000000..bfa71fe11 --- /dev/null +++ b/src/XGUI/XGUI_SwitchWidget.cpp @@ -0,0 +1,125 @@ +/* + * XGUI_SwitchWidget.cpp + * + * Created on: Apr 16, 2014 + * Author: sbh + */ + +#include + +#include +#include +#include + +XGUI_SwitchWidget::XGUI_SwitchWidget(QWidget* parent) +: QFrame(parent) +{ + myMainLay = new QVBoxLayout(this); + myMainLay->setContentsMargins(2, 4, 2, 2); + myCombo = new QComboBox(this); + myCombo->hide(); + myMainLay->addWidget(myCombo); + this->setFrameShape(QFrame::StyledPanel); + connect(myCombo, SIGNAL(currentIndexChanged(int)), + this, SLOT(setCurrentIndex(int))); + connect(myCombo, SIGNAL(currentIndexChanged(int)), + this, SIGNAL(currentPageChanged(int))); + +} + +XGUI_SwitchWidget::~XGUI_SwitchWidget() +{ +} + +int XGUI_SwitchWidget::addPage(QWidget* theWidget, const QString& theName) +{ + return insertPage(count(), theWidget, theName); +} + +int XGUI_SwitchWidget::count() const +{ + return myCombo->count(); +} + +int XGUI_SwitchWidget::currentIndex() const +{ + return myCombo->currentIndex(); +} + +QWidget* XGUI_SwitchWidget::currentWidget() const +{ + int idx = currentIndex(); + return myCases[idx]; +} + +int XGUI_SwitchWidget::indexOf(QWidget* theWidget) const +{ + return myCases.indexOf(theWidget); +} + +int XGUI_SwitchWidget::insertPage(int theIndex, QWidget* theWidget, const QString& theName) +{ + int index = theIndex < count() ? theIndex : count(); + if(count() == 0) + myCombo->show(); + myCombo->insertItem(index, theName); + myCases.insert(index, theWidget); + myMainLay->addWidget(theWidget); + setCurrentIndex(theIndex); + return index; +} + +bool XGUI_SwitchWidget::isPageEnabled(int index) const +{ + return myCases[index]->isEnabled(); +} + +QString XGUI_SwitchWidget::pageText(int index) const +{ + return myCombo->itemText(index); +} + +QString XGUI_SwitchWidget::pageToolTip(int index) const +{ + return myCases[index]->toolTip(); +} + +void XGUI_SwitchWidget::removePage(int index) +{ + myCombo->removeItem(index); + myCases.removeAt(index); + if (count() == 0) { + myCombo->hide(); + } +} + +void XGUI_SwitchWidget::setPageEnabled(int index, bool enabled) +{ + myCases[index]->setEnabled(enabled); +} + +void XGUI_SwitchWidget::setPageName(int index, const QString& theName) +{ + myCombo->setItemText(index, theName); +} + +void XGUI_SwitchWidget::setPageToolTip(int index, const QString& toolTip) +{ + myCases[index]->setToolTip(toolTip); +} + +void XGUI_SwitchWidget::setCurrentIndex(int index) +{ + myCombo->setCurrentIndex(index); + refresh(); +} + +void XGUI_SwitchWidget::refresh() +{ + foreach(QWidget* eachWidget, myCases) { + eachWidget->setVisible(false); + } + if(currentIndex() >= myCases.count()) + return; + myCases[currentIndex()]->setVisible(true); +} diff --git a/src/XGUI/XGUI_SwitchWidget.h b/src/XGUI/XGUI_SwitchWidget.h new file mode 100644 index 000000000..0fa6fcca3 --- /dev/null +++ b/src/XGUI/XGUI_SwitchWidget.h @@ -0,0 +1,53 @@ +/* + * XGUI_SwitchWidget.h + * + * Created on: Apr 16, 2014 + * Author: sbh + */ + +#ifndef XGUI_SWITCHWIDGET_H_ +#define XGUI_SWITCHWIDGET_H_ + +#include +#include + +class QComboBox; +class QVBoxLayout; + +class XGUI_EXPORT XGUI_SwitchWidget: public QFrame +{ + Q_OBJECT +public: + XGUI_SwitchWidget(QWidget* parent = NULL); + virtual ~XGUI_SwitchWidget(); + + int addPage(QWidget * theWidget, const QString & theName); + int count() const; + int currentIndex() const; + QWidget * currentWidget() const; + int indexOf(QWidget * theWidget) const; + int insertPage(int index, QWidget * theWidget, const QString & theName); + bool isPageEnabled(int index) const; + QString pageText(int index) const; + QString pageToolTip(int index) const; + void removePage(int index); + void setPageEnabled(int index, bool enabled); + void setPageName(int index, const QString & text); + void setPageToolTip(int index, const QString & toolTip); + +public slots: + void setCurrentIndex(int index); + +signals: + void currentPageChanged(int); + +protected: + void refresh(); + +private: + QVBoxLayout* myMainLay; + QComboBox* myCombo; + QWidgetList myCases; +}; + +#endif /* XGUI_SWITCHWIDGET_H_ */ diff --git a/src/XGUI/XGUI_WidgetFactory.cpp b/src/XGUI/XGUI_WidgetFactory.cpp index eeb6c10cd..bd08442a4 100644 --- a/src/XGUI/XGUI_WidgetFactory.cpp +++ b/src/XGUI/XGUI_WidgetFactory.cpp @@ -6,8 +6,10 @@ */ #include -#include +#include + +#include #include #include @@ -17,6 +19,8 @@ #include #include #include +#include +#include #ifdef _DEBUG #include @@ -33,33 +37,83 @@ XGUI_WidgetFactory::~XGUI_WidgetFactory() { } -void XGUI_WidgetFactory::fillWidget(QWidget* theParent) +void XGUI_WidgetFactory::createWidget(QWidget* theParent) { - myWidgetApi->reset(); - if (theParent->layout()) { - theParent->layout()->deleteLater(); - } + if (!myWidgetApi->toChildWidget()) + return; QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent); - aWidgetLay->setContentsMargins(0, 0, 0, 0); - do { + aWidgetLay->setContentsMargins(2, 2, 2, 2); + do { //Iterate over each node std::string aWdgType = myWidgetApi->widgetType(); - QWidget* aWidget = NULL; - if (aWdgType == NODE_DOUBLE_WDG) { - aWidget = doubleSpinBoxWidget(); - } else { - #ifdef _DEBUG - qDebug() << "XGUI_WidgetFactory::fillWidget: find bad widget type"; - #endif - } + //Create a widget (doublevalue, groupbox, toolbox, etc. + QWidget* aWidget = createWidgetByType(aWdgType, theParent); if (aWidget) { aWidgetLay->addWidget(aWidget); } - } while(myWidgetApi->nextWidget()); + if (myWidgetApi->isContainerWidget()) { + //if current widget is groupbox (container) process it's children recursively + QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); + createWidget(aWidget); + QGroupBox* aGrBox = qobject_cast(aWidget); + aGrBox->setTitle(aGroupName); + } + if (myWidgetApi->isPagedWidget()) { + //If current widget is toolbox or switch-casebox then fetch all + //it's pages recursively and setup into the widget. + myWidgetApi->toChildWidget(); + do { + QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); + QWidget* aPage = new QWidget(aWidget); + createWidget(aPage); + if (aWdgType == WDG_SWITCH) { + XGUI_SwitchWidget* aSwitch = qobject_cast(aWidget); + aSwitch->addPage(aPage, aPageName); + } else if (aWdgType == WDG_TOOLBOX){ + QToolBox* aToolbox = qobject_cast(aWidget); + aToolbox->addItem(aPage, aPageName); + } + } while(myWidgetApi->toNextWidget()); + } + } while(myWidgetApi->toNextWidget()); theParent->setLayout(aWidgetLay); } -QWidget* XGUI_WidgetFactory::doubleSpinBoxWidget() +QWidget* XGUI_WidgetFactory::createWidgetByType(const std::string& theType, QWidget* theParent) +{ + QWidget* result = NULL; + if (theType == WDG_DOUBLEVALUE) { + result = doubleSpinBoxControl(); + } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { + result = createContainer(theType, theParent); + } +#ifdef _DEBUG + else { qDebug() << "XGUI_WidgetFactory::fillWidget: find bad widget type"; } +#endif + return result; +} + +QWidget* XGUI_WidgetFactory::createContainer(const std::string& theType, QWidget* theParent) +{ + QWidget* result = NULL; + if (theType == WDG_GROUP || theType == WDG_CHECK_GROUP) { + QGroupBox* aGroupBox = new QGroupBox(theParent); + aGroupBox->setCheckable(theType == WDG_CHECK_GROUP); + result = aGroupBox; + } else if (theType == WDG_TOOLBOX) { + result = new QToolBox(theParent); + } else if (theType == WDG_SWITCH) { + result = new XGUI_SwitchWidget(theParent); + } else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE) { + result = NULL; + } +#ifdef _DEBUG + else { qDebug() << "XGUI_WidgetFactory::fillWidget: find bad container type"; } +#endif + return result; +} + +QWidget* XGUI_WidgetFactory::doubleSpinBoxControl() { QWidget* result = new QWidget(); QHBoxLayout* aControlLay = new QHBoxLayout(result); @@ -99,14 +153,14 @@ QWidget* XGUI_WidgetFactory::doubleSpinBoxWidget() aControlLay->addWidget(aBox); aControlLay->setStretch(1, 1); result->setLayout(aControlLay); - connectWidget(aBox, NODE_DOUBLE_WDG); + connectWidget(aBox, WDG_DOUBLEVALUE); return result; } -bool XGUI_WidgetFactory::connectWidget(QWidget* theWidget, const QString& theType) +bool XGUI_WidgetFactory::connectWidget(QWidget* theWidget, const QString& theType) { bool result = false; - if (theType == NODE_DOUBLE_WDG) { + if (theType == WDG_DOUBLEVALUE) { result = QObject::connect(theWidget, SIGNAL(valueChanged(double)), myOperation, SLOT(storeReal(double))); } diff --git a/src/XGUI/XGUI_WidgetFactory.h b/src/XGUI/XGUI_WidgetFactory.h index 99ab978b3..27a65fa43 100644 --- a/src/XGUI/XGUI_WidgetFactory.h +++ b/src/XGUI/XGUI_WidgetFactory.h @@ -21,18 +21,22 @@ public: XGUI_WidgetFactory(ModuleBase_Operation*); virtual ~XGUI_WidgetFactory(); - void fillWidget(QWidget* theParent); + void createWidget(QWidget* theParent); protected: - QWidget* doubleSpinBoxWidget(); - + //Widgets + QWidget* doubleSpinBoxControl(); + QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL); + QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL); bool connectWidget(QWidget*, const QString&); -private: QString qs(const std::string& theStdString) const; +private: Config_WidgetAPI* myWidgetApi; ModuleBase_Operation* myOperation; + + }; #endif /* XGUI_WIDGETFACTORY_H_ */ diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 25e3c14b1..58d5a87c1 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -211,7 +211,7 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) qDeleteAll(aPropWidget->children()); theOperation->start(); XGUI_WidgetFactory aFactory = XGUI_WidgetFactory(theOperation); - aFactory.fillWidget(aPropWidget); + aFactory.createWidget(aPropWidget); } void XGUI_Workshop::setCurrentOperation(ModuleBase_Operation* theOperation) -- 2.39.2