From: nds Date: Fri, 25 Apr 2014 13:57:22 +0000 (+0400) Subject: refs #30 - Sketch base GUI: create, draw lines X-Git-Tag: V_0.2~116^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0951dd3a93f5370e1b42aef86cccbe0aaa8df0a6;p=modules%2Fshaper.git refs #30 - Sketch base GUI: create, draw lines Line feature realization: 1. Create operation 2. Create point widget 3. Move widgets to ModuleBase --- diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 6c8f91835..61f09f5c3 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -27,6 +27,9 @@ const static char* WDG_TOOLBOX_BOX = "box"; const static char* WDG_SWITCH = "switch"; const static char* WDG_SWITCH_CASE = "case"; +//Specific widget containers +const static char* WDG_POINT_SELECTOR = "point_selector"; + const static char* _ID = "id"; //const static char* WORKBENCH_ID = "id"; //const static char* GROUP_ID = "id"; diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index fcd731c9e..116353000 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -5,14 +5,22 @@ SET(PROJECT_HEADERS ModuleBase.h ModuleBase_Operation.h ModuleBase_PropPanelOperation.h + ModuleBase_WidgetCustom.h + ModuleBase_WidgetFactory.h + ModuleBase_WidgetPoint2D.h + ModuleBase_WidgetSwitch.h ) SET(PROJECT_SOURCES ModuleBase_Operation.cpp ModuleBase_PropPanelOperation.cpp + ModuleBase_WidgetFactory.cpp + ModuleBase_WidgetPoint2D.cpp + ModuleBase_WidgetSwitch.cpp ) SET(PROJECT_LIBRARIES + Config ModelAPI ${QT_LIBRARIES} ) @@ -27,7 +35,11 @@ SET(PROJECT_AUTOMOC SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) #SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ModelAPI) +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/Config + ${CMAKE_SOURCE_DIR}/src/ModelAPI + ${CMAKE_SOURCE_DIR}/src/GeomDataAPI +) ADD_DEFINITIONS(-DMODULEBASE_EXPORTS) ADD_LIBRARY(ModuleBase SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 76459c132..519efbf13 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -7,6 +7,8 @@ #include "ModuleBase_Operation.h" +#include "ModuleBase_WidgetCustom.h" + #include #include #include @@ -14,6 +16,8 @@ #include #include +#include + #ifdef _DEBUG #include #endif @@ -264,6 +268,27 @@ void ModuleBase_Operation::storeReal(double theValue) aReal->setValue(theValue); } +/*! + * \brief Stores a real value in model. + * \param theValue - to store + * + * Public slot. Passes theValue into the model. + */ +void ModuleBase_Operation::storeCustomValue() +{ + if(!myFeature){ + #ifdef _DEBUG + qDebug() << "ModuleBase_Operation::storeCustom: " << + "trying to store value without opening a transaction."; + #endif + return; + } + + ModuleBase_WidgetCustom* aCustom = dynamic_cast(sender()); + if (aCustom) + aCustom->store(myFeature); +} + /*! * \brief Verifies whether operator is ready to start. * \return TRUE if operation is ready to start diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 75724ea34..818476d6f 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -111,6 +111,9 @@ public slots: // Data model operations. void storeReal(double); + // Data model operations. + void storeCustomValue(); + protected: virtual bool isReadyToStart() const; diff --git a/src/ModuleBase/ModuleBase_WidgetCustom.h b/src/ModuleBase/ModuleBase_WidgetCustom.h new file mode 100644 index 000000000..471d3f5ca --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetCustom.h @@ -0,0 +1,41 @@ +// File: ModuleBase_WidgetCustom.h +// Created: 25 Apr 2014 +// Author: Natalia ERMOLAEVA + +#ifndef ModuleBase_WidgetCustom_H +#define ModuleBase_WidgetCustom_H + +#include + +#include + +#include + +class ModelAPI_Feature; + +/**\class ModuleBase_WidgetCustom + * \ingroup GUI + * \brief An abstract custom widget class. This class realization is assumed to create some controls. + * The controls values modification should send signal about values change. Method store is used to fill + * the feature with the + */ +class MODULEBASE_EXPORT ModuleBase_WidgetCustom : public QObject +{ + Q_OBJECT +public: + /// Constructor + /// \theParent the parent object + ModuleBase_WidgetCustom(QObject* theParent) :QObject(theParent) {}; + /// Destructor + virtual ~ModuleBase_WidgetCustom() {}; + + /// Saves the internal parameters to the given feature + /// \param theFeature a model feature to be changed + virtual void store(boost::shared_ptr theFeature) = 0; + +signals: + /// The signal about widget values changed + void valuesChanged(); +}; + +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp new file mode 100644 index 000000000..d902d0eef --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -0,0 +1,214 @@ +/* + * ModuleBase_WidgetFactory.cpp + * + * Created on: Apr 3, 2014 + * Author: sbh + */ + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include +#include + +ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(ModuleBase_PropPanelOperation* theOperation) + : myOperation(theOperation) +{ + QString aXml = myOperation->xmlRepresentation(); + myWidgetApi = new Config_WidgetAPI(aXml.toStdString()); +} + +ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory() +{ +} + +void ModuleBase_WidgetFactory::createWidget(QWidget* theParent) +{ + if (!myWidgetApi->toChildWidget()) + return; + + QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent); + aWidgetLay->setContentsMargins(2, 2, 2, 2); + do { //Iterate over each node + std::string aWdgType = myWidgetApi->widgetType(); + //Create a widget (doublevalue, groupbox, toolbox, etc. + QWidget* aWidget = createWidgetByType(aWdgType, theParent); + if (aWidget) { + aWidgetLay->addWidget(aWidget); + } + 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) { + ModuleBase_WidgetSwitch* 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* ModuleBase_WidgetFactory::labelControl(QWidget* theParent) +{ + QWidget* result = new QWidget(theParent); + QVBoxLayout* aLabelLay = new QVBoxLayout(result); + QLabel* aLabel = new QLabel(result); + 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; +} + +QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType, QWidget* theParent) +{ + QWidget* result = NULL; + if (theType == WDG_DOUBLEVALUE) { + result = doubleSpinBoxControl(); + } else if (theType == WDG_INFO) { + result = labelControl(theParent); + } + else if (theType == WDG_POINT_SELECTOR) { + result = pointSelectorControl(theParent); + } + else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { + result = createContainer(theType, theParent); + } +#ifdef _DEBUG + else { qDebug() << "ModuleBase_WidgetFactory::fillWidget: find bad widget type"; } +#endif + return result; +} + +QWidget* ModuleBase_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 ModuleBase_WidgetSwitch(theParent); + } else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE) { + result = NULL; + } +#ifdef _DEBUG + else { qDebug() << "ModuleBase_WidgetFactory::fillWidget: find bad container type"; } +#endif + return result; +} + +QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl() +{ + QWidget* result = new QWidget(); + QHBoxLayout* aControlLay = new QHBoxLayout(result); + aControlLay->setContentsMargins(0, 0, 0, 0); + QString aLabelText = qs(myWidgetApi->widgetLabel()); + QString aLabelIcon = qs(myWidgetApi->widgetIcon()); + QLabel* aLabel = new QLabel(aLabelText); + aLabel->setPixmap(QPixmap(aLabelIcon)); + + aControlLay->addWidget(aLabel); + QDoubleSpinBox* aBox = new QDoubleSpinBox(result); + QString anObjName = QString::fromStdString(myWidgetApi->widgetId()); + aBox->setObjectName(anObjName); + bool isOk = false; + std::string aProp = myWidgetApi->getProperty(DOUBLE_WDG_MIN); + double aMinVal = qs(aProp).toDouble(&isOk); + if (isOk) { + aBox->setMinimum(aMinVal); + } else { + aBox->setMinimum(-DBL_MAX); + } + aProp = myWidgetApi->getProperty(DOUBLE_WDG_MAX); + double aMaxVal = qs(aProp).toDouble(&isOk); + if (isOk) { + aBox->setMaximum(aMaxVal); + } else { + aBox->setMaximum(DBL_MAX); + } + aProp = myWidgetApi->getProperty(DOUBLE_WDG_STEP); + double aStepVal = qs(aProp).toDouble(&isOk); + if (isOk) { + aBox->setSingleStep(aStepVal); + } + aProp = myWidgetApi->getProperty(DOUBLE_WDG_DFLT); + double aDefVal = qs(aProp).toDouble(&isOk); + if (isOk) { + aBox->setValue(aDefVal); + } + QString aTTip = qs(myWidgetApi->widgetTooltip()); + aBox->setToolTip(aTTip); + aControlLay->addWidget(aBox); + aControlLay->setStretch(1, 1); + result->setLayout(aControlLay); + connectWidget(aBox, WDG_DOUBLEVALUE); + return result; +} + +QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent) +{ + ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, + qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)), myWidgetApi->widgetId()); + connectWidget(aWidget, WDG_POINT_SELECTOR); + return aWidget->getControl(); +} + +bool ModuleBase_WidgetFactory::connectWidget(QObject* theWidget, const QString& theType) +{ + bool result = false; + if (theType == WDG_DOUBLEVALUE) { + result = QObject::connect(theWidget, SIGNAL(valueChanged(double)), + myOperation, SLOT(storeReal(double))); + } + if (theType == WDG_POINT_SELECTOR) { + ModuleBase_WidgetCustom* aCustom = dynamic_cast(theWidget); + result = QObject::connect(aCustom, SIGNAL(valuesChanged()), + myOperation, SLOT(storeCustomValue())); + } + return result; +} + +QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const +{ + return QString::fromStdString(theStdString); +} diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h new file mode 100644 index 000000000..404bcc057 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -0,0 +1,45 @@ +/* + * ModuleBase_WidgetFactory.h + * + * Created on: Apr 3, 2014 + * Author: sbh + */ + +#ifndef ModuleBase_WidgetFactory_H_ +#define ModuleBase_WidgetFactory_H_ + +#include +#include + +class QObject; +class QWidget; +class Config_WidgetAPI; +class ModuleBase_PropPanelOperation; + +class MODULEBASE_EXPORT ModuleBase_WidgetFactory +{ +public: + ModuleBase_WidgetFactory(ModuleBase_PropPanelOperation*); + virtual ~ModuleBase_WidgetFactory(); + + void createWidget(QWidget* theParent); + +protected: + //Widgets + QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL); + QWidget* labelControl(QWidget* theParent); + QWidget* doubleSpinBoxControl(); + QWidget* pointSelectorControl(QWidget* theParent); + QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL); + + bool connectWidget(QObject*, const QString&); + QString qs(const std::string& theStdString) const; + +private: + Config_WidgetAPI* myWidgetApi; + ModuleBase_PropPanelOperation* myOperation; + + +}; + +#endif /* ModuleBase_WidgetFactory_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp new file mode 100644 index 000000000..9cd0a47c9 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -0,0 +1,72 @@ +// File: ModuleBase_WidgetPoint2D.cpp +// Created: 25 Apr 2014 +// Author: Natalia ERMOLAEVA + +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + +ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent, QString theTitle, + const std::string& theFeatureAttributeID) +: ModuleBase_WidgetCustom(theParent), myFeatureAttributeID(theFeatureAttributeID) +{ + myGroupBox = new QGroupBox(theTitle, theParent); + QGridLayout* aGroupLay = new QGridLayout(myGroupBox); + aGroupLay->setContentsMargins(0, 0, 0, 0); + aGroupLay->setColumnStretch(1, 1); + { + QLabel* aLabel = new QLabel(myGroupBox); + aLabel->setText("X"); + aLabel->setPixmap(QPixmap(":pictures/x_point.png")); + aGroupLay->addWidget(aLabel, 0, 0); + + myXSpin = new QDoubleSpinBox(myGroupBox); + myXSpin->setMinimum(-DBL_MAX); + myXSpin->setMaximum(DBL_MAX); + myXSpin->setToolTip("X"); + aGroupLay->addWidget(myXSpin, 0, 1); + + connect(myXSpin, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); + } + { + QLabel* aLabel = new QLabel(myGroupBox); + aLabel->setText("Y"); + aLabel->setPixmap(QPixmap(":pictures/y_point.png")); + aGroupLay->addWidget(aLabel, 1, 0); + + myYSpin = new QDoubleSpinBox(myGroupBox); + myYSpin->setMinimum(-DBL_MAX); + myYSpin->setMaximum(DBL_MAX); + myYSpin->setToolTip("X"); + aGroupLay->addWidget(myYSpin, 1, 1); + + connect(myYSpin, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); + } +} + +ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D() +{ +} + +void ModuleBase_WidgetPoint2D::store(boost::shared_ptr theFeature) +{ + boost::shared_ptr aData = theFeature->data(); + boost::shared_ptr aPoint = + boost::dynamic_pointer_cast(aData->attribute(myFeatureAttributeID)); + + aPoint->setValue(myXSpin->value(), myYSpin->value()); +} + +QWidget* ModuleBase_WidgetPoint2D::getControl() const +{ + return myGroupBox; +} diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.h b/src/ModuleBase/ModuleBase_WidgetPoint2D.h new file mode 100644 index 000000000..a973ef693 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.h @@ -0,0 +1,50 @@ +// File: ModuleBase_WidgetPoint2D.h +// Created: 25 Apr 2014 +// Author: Natalia ERMOLAEVA + +#ifndef ModuleBase_WidgetPoint2D_H +#define ModuleBase_WidgetPoint2D_H + +#include +#include "ModuleBase_WidgetCustom.h" + +#include + +class ModelAPI_Feature; + +class QGroupBox; +class QDoubleSpinBox; + +/**\class ModuleBase_WidgetPoint2D + * \ingroup GUI + * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls + */ +class MODULEBASE_EXPORT ModuleBase_WidgetPoint2D : public ModuleBase_WidgetCustom +{ + Q_OBJECT +public: + /// Constructor + /// \theParent the parent object + /// \theTitle the group box title + /// \theFeatureAttributeID the identifier of the feature attribute + ModuleBase_WidgetPoint2D(QWidget* theParent, QString theTitle, + const std::string& theFeatureAttributeID); + /// Destructor + virtual ~ModuleBase_WidgetPoint2D(); + + /// Saves the internal parameters to the given feature + /// \param theFeature a model feature to be changed + virtual void store(boost::shared_ptr theFeature); + + /// Returns the internal parent wiget control, that can be shown anywhere + /// \returns the widget + QWidget* getControl() const; + +private: + std::string myFeatureAttributeID; ///< the identifier of the feature attribute + QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets + QDoubleSpinBox* myXSpin; ///< the spin box for the X coordinate + QDoubleSpinBox* myYSpin; ///< the spin box for the Y coordinate +}; + +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp new file mode 100644 index 000000000..3024f1166 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp @@ -0,0 +1,125 @@ +/* + * ModuleBase_WidgetSwitch.cpp + * + * Created on: Apr 16, 2014 + * Author: sbh + */ + +#include + +#include +#include +#include + +ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(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))); + +} + +ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() +{ +} + +int ModuleBase_WidgetSwitch::addPage(QWidget* theWidget, const QString& theName) +{ + return insertPage(count(), theWidget, theName); +} + +int ModuleBase_WidgetSwitch::count() const +{ + return myCombo->count(); +} + +int ModuleBase_WidgetSwitch::currentIndex() const +{ + return myCombo->currentIndex(); +} + +QWidget* ModuleBase_WidgetSwitch::currentWidget() const +{ + int idx = currentIndex(); + return myCases[idx]; +} + +int ModuleBase_WidgetSwitch::indexOf(QWidget* theWidget) const +{ + return myCases.indexOf(theWidget); +} + +int ModuleBase_WidgetSwitch::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 ModuleBase_WidgetSwitch::isPageEnabled(int index) const +{ + return myCases[index]->isEnabled(); +} + +QString ModuleBase_WidgetSwitch::pageText(int index) const +{ + return myCombo->itemText(index); +} + +QString ModuleBase_WidgetSwitch::pageToolTip(int index) const +{ + return myCases[index]->toolTip(); +} + +void ModuleBase_WidgetSwitch::removePage(int index) +{ + myCombo->removeItem(index); + myCases.removeAt(index); + if (count() == 0) { + myCombo->hide(); + } +} + +void ModuleBase_WidgetSwitch::setPageEnabled(int index, bool enabled) +{ + myCases[index]->setEnabled(enabled); +} + +void ModuleBase_WidgetSwitch::setPageName(int index, const QString& theName) +{ + myCombo->setItemText(index, theName); +} + +void ModuleBase_WidgetSwitch::setPageToolTip(int index, const QString& toolTip) +{ + myCases[index]->setToolTip(toolTip); +} + +void ModuleBase_WidgetSwitch::setCurrentIndex(int index) +{ + myCombo->setCurrentIndex(index); + refresh(); +} + +void ModuleBase_WidgetSwitch::refresh() +{ + foreach(QWidget* eachWidget, myCases) { + eachWidget->setVisible(false); + } + if(currentIndex() >= myCases.count()) + return; + myCases[currentIndex()]->setVisible(true); +} diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.h b/src/ModuleBase/ModuleBase_WidgetSwitch.h new file mode 100644 index 000000000..08ce3bc71 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.h @@ -0,0 +1,53 @@ +/* + * ModuleBase_WidgetSwitch.h + * + * Created on: Apr 16, 2014 + * Author: sbh + */ + +#ifndef ModuleBase_WidgetSwitch_H_ +#define ModuleBase_WidgetSwitch_H_ + +#include +#include + +class QComboBox; +class QVBoxLayout; + +class MODULEBASE_EXPORT ModuleBase_WidgetSwitch: public QFrame +{ + Q_OBJECT +public: + ModuleBase_WidgetSwitch(QWidget* parent = NULL); + virtual ~ModuleBase_WidgetSwitch(); + + 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 /* ModuleBase_WidgetSwitch_H_ */ diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index f8ce75a92..5a999aaba 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -7,13 +7,15 @@ SET(PROJECT_HEADERS PartSet.h PartSet_Module.h PartSet_OperationSketchBase.h - PartSet_OperationSketch.h + PartSet_OperationSketch.h + PartSet_OperationSketchLine.h ) SET(PROJECT_SOURCES PartSet_Module.cpp PartSet_OperationSketchBase.cpp PartSet_OperationSketch.cpp + PartSet_OperationSketchLine.cpp ) SET(PROJECT_RESOURCES diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 71d0987a4..c76792ca1 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1,5 +1,6 @@ #include #include +#include #include @@ -80,7 +81,15 @@ void PartSet_Module::onFeatureTriggered() ModuleBase_PropPanelOperation* aPartSetOp; if (aCmdId == "Sketch" ) { aPartSetOp = new PartSet_OperationSketch(aCmdId, this); - } else { + } + else if(aCmdId == "SketchLine") { + ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); + boost::shared_ptr aSketchFeature; + if (anOperation) + aSketchFeature = anOperation->feature(); + aPartSetOp = new PartSet_OperationSketchLine(aCmdId, this, aSketchFeature); + } + else { aPartSetOp = new ModuleBase_PropPanelOperation(aCmdId, this); } aPartSetOp->setXmlRepresentation(QString::fromStdString(aXmlCfg)); diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index c343503e2..7eca33e43 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -82,5 +82,6 @@ void PartSet_OperationSketch::setSelectedShapes(const NCollection_List aDir = aPlane->direction(); emit viewerProjectionChange(aDir->x(), aDir->y(), aDir->z()); - commit(); + //commit(); + //SketchPlugin_Sketch::setActive(myFeature); } diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp new file mode 100644 index 000000000..7a5a78196 --- /dev/null +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -0,0 +1,52 @@ +// File: PartSet_OperationSketchLine.h +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + +#include + +#include + +#ifdef _DEBUG +#include +#endif + +using namespace std; + +PartSet_OperationSketchLine::PartSet_OperationSketchLine(const QString& theId, + QObject* theParent, + boost::shared_ptr theFeature) +: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature) +{ +} + +PartSet_OperationSketchLine::~PartSet_OperationSketchLine() +{ +} + +bool PartSet_OperationSketchLine::isPerformedImmediately() const +{ + return false; +} + +int PartSet_OperationSketchLine::getSelectionMode() const +{ + return TopAbs_FACE; +} + +void PartSet_OperationSketchLine::setSelectedShapes(const NCollection_List& theList) +{ + if (theList.IsEmpty()) + return; +} + +void PartSet_OperationSketchLine::startOperation() +{ + PartSet_OperationSketchBase::startOperation(); + + if (mySketch) { + boost::shared_ptr aFeature = + boost::dynamic_pointer_cast(mySketch); + + aFeature->addSub(feature()); + } +} diff --git a/src/PartSet/PartSet_OperationSketchLine.h b/src/PartSet/PartSet_OperationSketchLine.h new file mode 100644 index 000000000..7c228af06 --- /dev/null +++ b/src/PartSet/PartSet_OperationSketchLine.h @@ -0,0 +1,51 @@ +// File: PartSet_OperationSketchLine.h +// Created: 20 Apr 2014 +// Author: Natalia ERMOLAEVA + +#ifndef PartSet_OperationSketchLine_H +#define PartSet_OperationSketchLine_H + +#include "PartSet.h" + +#include +#include + +/*! + \class PartSet_OperationSketchLine + * \brief The operation for the sketch feature creation +*/ +class PARTSET_EXPORT PartSet_OperationSketchLine : public PartSet_OperationSketchBase +{ + Q_OBJECT +public: + /// Constructor + /// \param theId the feature identifier + /// \param theParent the operation parent + /// \param theFeature the parent feature + PartSet_OperationSketchLine(const QString& theId, QObject* theParent, + boost::shared_ptr theSketchFeature); + /// Destructor + virtual ~PartSet_OperationSketchLine(); + + /// The sketch can not be created immediately, firstly a plane should be set + virtual bool isPerformedImmediately() const; + + /// Returns the operation local selection mode + /// \return the selection mode + virtual int getSelectionMode() const; + + /// Gives the current selected objects to be processed by the operation + /// \param theList a list of interactive selected shapes + virtual void setSelectedShapes(const NCollection_List& theList); + +protected: + /// \brief Virtual method called when operation is started + /// Virtual method called when operation started (see start() method for more description) + /// After the parent operation body perform, set sketch feature to the created line feature + virtual void startOperation(); + +private: + boost::shared_ptr mySketch; ///< the sketch feature +}; + +#endif diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 9d0ae5092..7877a7191 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -38,6 +38,11 @@ public: /// Returns the sketch preview SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr& preview(); + /// Adds sub-feature of the higher level feature (sub-element of the sketch) + /// \param theFeature sub-feature + SKETCHPLUGIN_EXPORT virtual const void addSub( + const boost::shared_ptr& theFeature) {}; + /// Use plugin manager for features creation SketchPlugin_Line(); }; diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 114940981..ab95647ee 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -1,5 +1,6 @@ #include "SketchPlugin_Plugin.h" #include "SketchPlugin_Sketch.h" +#include "SketchPlugin_Line.h" #include #include @@ -19,9 +20,9 @@ boost::shared_ptr SketchPlugin_Plugin::createFeature(string th if (theFeatureID == "Sketch") { return boost::shared_ptr(new SketchPlugin_Sketch); } - /*else if (theFeatureID == "Point") { - return shared_ptr(new SketchPlugin_Point); - }*/ + else if (theFeatureID == "SketchLine") { + return boost::shared_ptr(new SketchPlugin_Line); + } // feature of such kind is not found return boost::shared_ptr(); } diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 09ac545be..489bf53e6 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -2,9 +2,13 @@ - + + + + diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index a246e4060..106d695b7 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -19,14 +19,12 @@ SET(PROJECT_HEADERS XGUI_RubberBand.h XGUI_Constants.h XGUI_ViewBackground.h - XGUI_WidgetFactory.h XGUI_DocumentDataModel.h XGUI_PartDataModel.h XGUI_ObjectsBrowser.h XGUI_OperationMgr.h XGUI_DataTreeModel.h XGUI_SelectionMgr.h - XGUI_SwitchWidget.h ) SET(PROJECT_AUTOMOC @@ -47,13 +45,11 @@ SET(PROJECT_SOURCES XGUI_Viewer.cpp XGUI_RubberBand.cpp XGUI_ViewBackground.cpp - XGUI_WidgetFactory.cpp XGUI_DocumentDataModel.cpp XGUI_PartDataModel.cpp XGUI_ObjectsBrowser.cpp XGUI_OperationMgr.cpp XGUI_SelectionMgr.cpp - XGUI_SwitchWidget.cpp ) SET(PROJECT_RESOURCES diff --git a/src/XGUI/XGUI_SwitchWidget.cpp b/src/XGUI/XGUI_SwitchWidget.cpp deleted file mode 100644 index bfa71fe11..000000000 --- a/src/XGUI/XGUI_SwitchWidget.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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 deleted file mode 100644 index 0fa6fcca3..000000000 --- a/src/XGUI/XGUI_SwitchWidget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 17c3ab6c3..000000000 --- a/src/XGUI/XGUI_WidgetFactory.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * XGUI_WidgetFactory.cpp - * - * Created on: Apr 3, 2014 - * Author: sbh - */ - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _DEBUG -#include -#endif - -#include -#include - -XGUI_WidgetFactory::XGUI_WidgetFactory(ModuleBase_PropPanelOperation* theOperation) - : myOperation(theOperation) -{ - QString aXml = myOperation->xmlRepresentation(); - myWidgetApi = new Config_WidgetAPI(aXml.toStdString()); -} - -XGUI_WidgetFactory::~XGUI_WidgetFactory() -{ -} - -void XGUI_WidgetFactory::createWidget(QWidget* theParent) -{ - if (!myWidgetApi->toChildWidget()) - return; - - QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent); - aWidgetLay->setContentsMargins(2, 2, 2, 2); - do { //Iterate over each node - std::string aWdgType = myWidgetApi->widgetType(); - //Create a widget (doublevalue, groupbox, toolbox, etc. - QWidget* aWidget = createWidgetByType(aWdgType, theParent); - if (aWidget) { - aWidgetLay->addWidget(aWidget); - } - 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::labelControl(QWidget* theParent) -{ - QWidget* result = new QWidget(theParent); - QVBoxLayout* aLabelLay = new QVBoxLayout(result); - QLabel* aLabel = new QLabel(result); - 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; -} - -QWidget* XGUI_WidgetFactory::createWidgetByType(const std::string& theType, QWidget* theParent) -{ - QWidget* result = NULL; - if (theType == WDG_DOUBLEVALUE) { - result = doubleSpinBoxControl(); - } else if (theType == WDG_INFO) { - result = labelControl(theParent); - } 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); - aControlLay->setContentsMargins(0, 0, 0, 0); - QString aLabelText = qs(myWidgetApi->widgetLabel()); - QString aLabelIcon = qs(myWidgetApi->widgetIcon()); - QLabel* aLabel = new QLabel(aLabelText); - aLabel->setPixmap(QPixmap(aLabelIcon)); - - aControlLay->addWidget(aLabel); - QDoubleSpinBox* aBox = new QDoubleSpinBox(result); - QString anObjName = QString::fromStdString(myWidgetApi->widgetId()); - aBox->setObjectName(anObjName); - bool isOk = false; - std::string aProp = myWidgetApi->getProperty(DOUBLE_WDG_MIN); - double aMinVal = qs(aProp).toDouble(&isOk); - if (isOk) { - aBox->setMinimum(aMinVal); - } else { - aBox->setMinimum(-DBL_MAX); - } - aProp = myWidgetApi->getProperty(DOUBLE_WDG_MAX); - double aMaxVal = qs(aProp).toDouble(&isOk); - if (isOk) { - aBox->setMaximum(aMaxVal); - } else { - aBox->setMaximum(DBL_MAX); - } - aProp = myWidgetApi->getProperty(DOUBLE_WDG_STEP); - double aStepVal = qs(aProp).toDouble(&isOk); - if (isOk) { - aBox->setSingleStep(aStepVal); - } - aProp = myWidgetApi->getProperty(DOUBLE_WDG_DFLT); - double aDefVal = qs(aProp).toDouble(&isOk); - if (isOk) { - aBox->setValue(aDefVal); - } - QString aTTip = qs(myWidgetApi->widgetTooltip()); - aBox->setToolTip(aTTip); - aControlLay->addWidget(aBox); - aControlLay->setStretch(1, 1); - result->setLayout(aControlLay); - connectWidget(aBox, WDG_DOUBLEVALUE); - return result; -} - -bool XGUI_WidgetFactory::connectWidget(QWidget* theWidget, const QString& theType) -{ - bool result = false; - if (theType == WDG_DOUBLEVALUE) { - result = QObject::connect(theWidget, SIGNAL(valueChanged(double)), - myOperation, SLOT(storeReal(double))); - } - return result; -} - -QString XGUI_WidgetFactory::qs(const std::string& theStdString) const -{ - return QString::fromStdString(theStdString); -} diff --git a/src/XGUI/XGUI_WidgetFactory.h b/src/XGUI/XGUI_WidgetFactory.h deleted file mode 100644 index d83d8fbb4..000000000 --- a/src/XGUI/XGUI_WidgetFactory.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * XGUI_WidgetFactory.h - * - * Created on: Apr 3, 2014 - * Author: sbh - */ - -#ifndef XGUI_WIDGETFACTORY_H_ -#define XGUI_WIDGETFACTORY_H_ - -#include "XGUI.h" -#include - -class QWidget; -class Config_WidgetAPI; -class ModuleBase_PropPanelOperation; - -class XGUI_EXPORT XGUI_WidgetFactory -{ -public: - XGUI_WidgetFactory(ModuleBase_PropPanelOperation*); - virtual ~XGUI_WidgetFactory(); - - void createWidget(QWidget* theParent); - -protected: - //Widgets - QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL); - QWidget* labelControl(QWidget* theParent); - QWidget* doubleSpinBoxControl(); - QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL); - - bool connectWidget(QWidget*, const QString&); - QString qs(const std::string& theStdString) const; - -private: - Config_WidgetAPI* myWidgetApi; - ModuleBase_PropPanelOperation* myOperation; - - -}; - -#endif /* XGUI_WIDGETFACTORY_H_ */ diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index cbc3ce146..6518d05e7 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -8,7 +8,7 @@ #include "XGUI_Workbench.h" #include "XGUI_Workshop.h" #include "XGUI_Viewer.h" -#include "XGUI_WidgetFactory.h" +#include "ModuleBase_WidgetFactory.h" #include "XGUI_SelectionMgr.h" #include "XGUI_ObjectsBrowser.h" #include "XGUI_Displayer.h" @@ -187,7 +187,7 @@ void XGUI_Workshop::onOperationStarted() myMainWindow->showPropertyPanel(); - XGUI_WidgetFactory aFactory = XGUI_WidgetFactory(aOperation); + ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation); aFactory.createWidget(aPropWidget); myMainWindow->setPropertyPannelTitle(aOperation->description()); }