From 322bc04c30609d50bd763a8dbe014284d0f0e8d6 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 21 Nov 2019 17:36:58 +0300 Subject: [PATCH] Issue #3073: Show inspection panel for features --- src/ModuleBase/ModuleBase_ChoiceCtrl.cpp | 4 + src/ModuleBase/ModuleBase_IModule.h | 5 +- src/ModuleBase/ModuleBase_ModelWidget.cpp | 6 + src/ModuleBase/ModuleBase_ModelWidget.h | 7 + src/ModuleBase/ModuleBase_ToolBox.cpp | 4 + .../ModuleBase_WidgetDoubleValue.cpp | 12 -- src/PartSet/PartSet_Module.cpp | 12 +- src/PartSet/PartSet_Module.h | 5 +- src/PartSet/PartSet_WidgetSketchCreator.h | 3 + src/PartSet/PartSet_WidgetSketchLabel.cpp | 1 - src/PartSet/PartSet_WidgetSketchLabel.h | 7 + src/XGUI/XGUI_InspectionPanel.cpp | 134 ++++++++++++++---- src/XGUI/XGUI_InspectionPanel.h | 36 +++-- src/XGUI/XGUI_SelectionMgr.cpp | 2 + src/XGUI/XGUI_SelectionMgr.h | 6 + src/XGUI/XGUI_Workshop.cpp | 6 +- 16 files changed, 183 insertions(+), 67 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp index 1c887faa4..3404b55f2 100644 --- a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp +++ b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp @@ -29,6 +29,9 @@ #include #include +const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; + + ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent, const QStringList& theChoiceList, const QStringList& theIconsList, @@ -68,6 +71,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent, QPixmap aIcon = ModuleBase_IconFactory::loadPixmap(theIconsList.at(aId)); aBtn->setIcon(aIcon); aBtn->setIconSize(aIcon.size()); + aBtn->setStyleSheet(AStyle); aBtnLayout->addWidget(aBtn); myButtons->addButton(aBtn, aId++); diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index b748d6a14..7633da41f 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -169,10 +169,11 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Have an opportunity to create widgets for the current operation /// instead of standard creation in workshop - /// \param theOperation a started operation + /// \param theFeature a feature of the started operation + /// \param theXmlRepr an XML representation of the operation /// \param theWidgets a list of created widgets /// \return boolean result, false by default - virtual bool createWidgets(ModuleBase_Operation* theOperation, + virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, QList& theWidgets) const { return false; } //! Returns True if there are available Undos and there is not an active operation diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 89546edfd..f26b8a600 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -423,6 +423,12 @@ bool ModuleBase_ModelWidget::blockValueState(const bool theBlocked) //************************************************************** bool ModuleBase_ModelWidget::restoreValue() { + if (!isEnabled()) { + // This code works in inspection panel + ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + if (!aValidators->isCase(myFeature, attributeID())) + return false; // if it is not an active case for the widget + } emit beforeValuesRestored(); bool isDone = restoreValueCustom(); emit afterValuesRestored(); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index fdd467481..3d667f6f1 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -303,6 +303,13 @@ Q_OBJECT /// By default this slot does nothing virtual void onFeatureAccepted() {} + /// Returns True in case if the widget contains useful information for inspection tool + virtual bool isInformative() const { return true; } + + /// If widgets has several panels then this method has to show a page which contains information + /// for current feature. By default does nothing + virtual void showInformativePage() {} + signals: /// The signal about widget values are to be changed void beforeValuesChanged(); diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index 8618e3b34..ab6296671 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.cpp +++ b/src/ModuleBase/ModuleBase_ToolBox.cpp @@ -28,6 +28,9 @@ #include +const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}"; + + ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget* theParent, const bool theUseFrameStyleBox) : QFrame(theParent) { @@ -71,6 +74,7 @@ void ModuleBase_ToolBox::addItem(QWidget* thePage, const QString& theName, const QToolButton* aButton = new QToolButton(myButtonsFrame); aButton->setFocusPolicy(Qt::StrongFocus); aButton->setCheckable(true); + aButton->setStyleSheet(AStyle); if (theIcon.isNull()) aButton->setText(theName); else { diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 4b0e41daa..54cc1d3ce 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -195,18 +195,6 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom() std::string aTextRepr = aRef->text(); if (!aTextRepr.empty()) { QString aText = QString::fromStdString(aTextRepr); - //if (aText.endsWith('=')) { - // if (!myParameter.get()) { - // QString aName = aText.left(aText.indexOf('=')).trimmed(); - // myParameter = ModuleBase_Tools::findParameter(aName); - // } - // /// If myParameter is empty then it was not created because of an error - // if (!myParameter.get()) - // return false; - - // AttributeStringPtr aExprAttr = myParameter->string("expression"); - // aText += aExprAttr->value().c_str(); - //} ModuleBase_Tools::setSpinText(mySpinBox, aText); } else { diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 59d1b14da..cc7c8b7f8 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -753,16 +753,14 @@ void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) } //****************************************************** -bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation, +bool PartSet_Module::createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, QList& theWidgets) const { bool aProcessed = false; - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(theOperation); XGUI_Workshop* aWorkshop = getWorkshop(); XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); - if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) { + if (mySketchMgr->activeSketch().get() && aPropertyPanel) { ModuleBase_ISelection* aSelection = workshop()->selection(); // click on a point in sketch leads here with the point is highlighted, not yet selected QList aPreselection = aSelection->getHighlighted(); @@ -771,11 +769,10 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation, ObjectPtr anObject = aSelectedPrs->object(); FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - FeaturePtr anOpFeature = aFOperation->feature(); GeomShapePtr aShape = aSelectedPrs->shape(); // click on the digit of dimension constrain comes here // with an empty shape, so we need the check - if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) { + if (aFeature == theFeature && aShape.get() && !aShape->isNull()) { // if feature has only one result and shape of result is equal to selected shape // this attribute is not processed. It is a case of Sketch Point. if (aFeature->results().size() == 1) { @@ -787,8 +784,7 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation, AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape, mySketchMgr->activeSketch()); if (anAttribute.get()) { - QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); - ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop()); + ModuleBase_WidgetFactory aFactory(theXmlRepr.toStdString(), workshop()); const std::string anAttributeId = anAttribute->id(); aFactory.createWidget(aPropertyPanel->contentWidget(), anAttributeId); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index bcd16ee17..e0b6961fa 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -105,10 +105,11 @@ public: /// If there is found selected attribute, widgets are created and contains /// only a widget for the attribute /// It is important for Property Panel filling by sketch point attribute - /// \param theOperation a started operation + /// \param theFeature a feature of the started operation + /// \param theXmlRepr an XML representation of the operation /// \param theWidgets a list of created widgets /// \return boolean result, false by default - virtual bool createWidgets(ModuleBase_Operation* theOperation, + virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr, QList& theWidgets) const; /// Launching of a edit operation on the feature diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index f4a880abf..0e32b0285 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -83,6 +83,9 @@ public: /// \return a boolean value virtual bool isValidSelection(const std::shared_ptr& theValue); + /// Returns True in case if the widget contains useful information for inspection tool + virtual bool isInformative() const { return false; } + protected: /// If there is no operation in current session, start operation for modify parameters /// \return true if the operation was not opened diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index f4514b927..b05bbfd75 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -75,7 +75,6 @@ #include #include #include -#include #include #include #include diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index fbc339502..9144f9ef4 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -31,6 +31,7 @@ #include +#include #include class PartSet_PreviewPlanes; @@ -110,6 +111,12 @@ public: /// \param thePrs a presentation static bool canFillSketch(const std::shared_ptr& thePrs); + /// If widgets has several panels then this method has to show a page which contains information + /// for current feature. By default does nothing + virtual void showInformativePage() { + if (myStackWidget) myStackWidget->setCurrentIndex(1); + } + signals: /// Signal on plane selection void planeSelected(const std::shared_ptr& thePln); diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp index 6d615ac06..038f5f172 100644 --- a/src/XGUI/XGUI_InspectionPanel.cpp +++ b/src/XGUI/XGUI_InspectionPanel.cpp @@ -18,12 +18,19 @@ // #include "XGUI_InspectionPanel.h" +#include "XGUI_Workshop.h" #include "XGUI_SelectionMgr.h" #include "XGUI_Selection.h" #include "XGUI_Tools.h" +#include "XGUI_ModuleConnector.h" #include #include +#include +#include +#include +#include + #include #include @@ -54,6 +61,7 @@ #include #include #include +#include #include #include @@ -61,6 +69,7 @@ #include #include // CAREFUL ! position of this file is critic + // ================ Auxiliary functions ================ #define TITLE(val) ("" + (val) + "") @@ -108,15 +117,18 @@ static void appendNamedValueToParameters(const QString& theName, // ================ XGUI_InspectionPanel ================ -XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr) +XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop) : QDockWidget(theParent), - mySelectionMgr(theMgr) + myWorkshop(theWorkshop) { setWindowTitle(tr("Inspection Panel")); setObjectName(INSPECTION_PANEL); setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); - QSplitter* aSplitter = new QSplitter(Qt::Vertical, this); + myStackWgt = new QStackedWidget(this); + + // Create shape selection page + QSplitter* aSplitter = new QSplitter(Qt::Vertical, myStackWgt); // Create an internal widget QWidget* aNameWgt = new QWidget(aSplitter); @@ -184,9 +196,23 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr aSizes << 10 << 140 << 10; aSplitter->setSizes(aSizes); - setWidget(aSplitter); + myShapePanelId = myStackWgt->addWidget(aSplitter); + + // Create feature selection page + QScrollArea* aScroll = new QScrollArea(myStackWgt); + aScroll->setWidgetResizable(true); + aScroll->setFrameStyle(QFrame::NoFrame); + + myFeaturePane = new ModuleBase_PageWidget(aScroll); + myFeatureLayout = new QGridLayout(myFeaturePane); + myFeatureLayout->setContentsMargins(3, 3, 3, 3); + aScroll->setWidget(myFeaturePane); + //myFeaturePane->setEnabled(false); - connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged())); + myFeaturePanelId = myStackWgt->addWidget(aScroll); + + setWidget(myStackWgt); + connect(myWorkshop->selector(), SIGNAL(selectionChanged()), SLOT(onSelectionChanged())); } //******************************************************************** @@ -209,20 +235,21 @@ void XGUI_InspectionPanel::clearContent() } myTypeLbl->setText(""); setParamsText(""); + + myFeaturePane->clearPage(); } //******************************************************************** void XGUI_InspectionPanel::onSelectionChanged() { + if (!isVisible()) + return; + clearContent(); - XGUI_Selection* aSelection = mySelectionMgr->selection(); - QList aSelectedList = - aSelection->getSelected(ModuleBase_ISelection::Viewer); - QList anOBSelected = - aSelection->getSelected(ModuleBase_ISelection::Browser); - if (!anOBSelected.isEmpty()) - ModuleBase_ISelection::appendSelected(anOBSelected, aSelectedList); + XGUI_Selection* aSelection = myWorkshop->selector()->selection(); + QList aSelectedList = + aSelection->getSelected(myWorkshop->selector()->placeOfSelection()); if (aSelectedList.count() > 0) { ModuleBase_ViewerPrsPtr aPrs = aSelectedList.first(); @@ -230,25 +257,33 @@ void XGUI_InspectionPanel::onSelectionChanged() std::dynamic_pointer_cast(aPrs->object()); if (aStep) return; - TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs); - if (aShape.IsNull()) { - ResultPtr aRes = std::dynamic_pointer_cast(aPrs->object()); - if (aRes.get()) { - GeomShapePtr aShpPtr = aRes->shape(); - if (aShpPtr.get()) { - aShape = aShpPtr->impl(); + FeaturePtr aFeature = std::dynamic_pointer_cast(aPrs->object()); + if (aFeature.get()) { + myStackWgt->setCurrentIndex(myFeaturePanelId); + buildFeaturePane(aFeature); + } + else { + myStackWgt->setCurrentIndex(myShapePanelId); + TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs); + if (aShape.IsNull()) { + ResultPtr aRes = std::dynamic_pointer_cast(aPrs->object()); + if (aRes.get()) { + GeomShapePtr aShpPtr = aRes->shape(); + if (aShpPtr.get()) { + aShape = aShpPtr->impl(); + } } } + if (aShape.IsNull()) + return; + GeomShapePtr aShapePtr(new GeomAPI_Shape()); + aShapePtr->setImpl(new TopoDS_Shape(aShape)); + + ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr)); + setName(XGUI_Tools::generateName(aPrsCopy)); + setShapeContent(aShape); + setShapeParams(aShape); } - if (aShape.IsNull()) - return; - GeomShapePtr aShapePtr(new GeomAPI_Shape()); - aShapePtr->setImpl(new TopoDS_Shape(aShape)); - - ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr)); - setName(XGUI_Tools::generateName(aPrsCopy)); - setShapeContent(aShape); - setShapeParams(aShape); } } @@ -606,6 +641,7 @@ void XGUI_InspectionPanel::fillContainer(const GeomShapePtr& theShape) appendPointToParameters(tr("Maximal corner"), aMaxPoint, aParams); } +//******************************************************************** void XGUI_InspectionPanel::setPlaneType(const QString& theTitle, const std::shared_ptr& thePlane) { @@ -616,6 +652,7 @@ void XGUI_InspectionPanel::setPlaneType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setSphereType(const QString& theTitle, const std::shared_ptr& theSphere) { @@ -627,6 +664,7 @@ void XGUI_InspectionPanel::setSphereType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setCylinderType(const QString& theTitle, const std::shared_ptr& theCyl) { @@ -640,6 +678,7 @@ void XGUI_InspectionPanel::setCylinderType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setConeType(const QString& theTitle, const std::shared_ptr& theCone) { @@ -654,6 +693,7 @@ void XGUI_InspectionPanel::setConeType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setTorusType(const QString& theTitle, const std::shared_ptr& theTorus) { @@ -667,6 +707,7 @@ void XGUI_InspectionPanel::setTorusType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setBoxType(const QString& theTitle, const std::shared_ptr& theBox) { @@ -680,6 +721,7 @@ void XGUI_InspectionPanel::setBoxType(const QString& theTitle, setParamsText(aParams); } +//******************************************************************** void XGUI_InspectionPanel::setRotatedBoxType(const QString& theTitle, const std::shared_ptr& theBox) { @@ -697,7 +739,43 @@ void XGUI_InspectionPanel::setRotatedBoxType(const QString& theTitle, } +//******************************************************************** void XGUI_InspectionPanel::setParamsText(const QString& theText) { myTypeParams->setText(theText); } + +//******************************************************************** +void XGUI_InspectionPanel::buildFeaturePane(const FeaturePtr& theFeature) +{ + std::string aXmlCfg, aDescription; + myWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription); + if (!aXmlCfg.empty()) { + QList aWidgets; + if (!myWorkshop->module()->createWidgets(theFeature, aXmlCfg.c_str(), aWidgets)) { + ModuleBase_WidgetFactory aFactory(aXmlCfg, myWorkshop->moduleConnector()); + aFactory.createWidget(myFeaturePane); + aWidgets = aFactory.getModelWidgets(); + } + foreach(ModuleBase_ModelWidget* aWgt, aWidgets) { + if (aWgt->isInformative()) { + aWgt->setEnabled(false); + aWgt->setFeature(theFeature, false, false); + aWgt->setEditingMode(true); + aWgt->restoreValue(); + aWgt->showInformativePage(); + } + else { + aWgt->setFeature(theFeature, false, false); + aWgt->setEditingMode(true); + aWgt->hide(); + } + } + } +} + +void XGUI_InspectionPanel::showEvent(QShowEvent* theEvent) +{ + QDockWidget::showEvent(theEvent); + onSelectionChanged(); +} diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h index 3f980ea42..9f60ff56e 100644 --- a/src/XGUI/XGUI_InspectionPanel.h +++ b/src/XGUI/XGUI_InspectionPanel.h @@ -22,17 +22,21 @@ #include "XGUI.h" +#include + #include #include -class XGUI_SelectionMgr; +class XGUI_Workshop; class QLineEdit; class QTableWidget; class QLabel; class QTextBrowser; class QVBoxLayout; class QResizeEvent; +class QStackedWidget; +class QGridLayout; class TopoDS_Shape; @@ -50,6 +54,7 @@ class GeomAPI_Cylinder; class GeomAPI_Cone; class GeomAPI_Torus; class GeomAPI_Box; +class ModuleBase_PageWidget; /// Internal name of property panel widget const static char* INSPECTION_PANEL = "inspection_panel_dock"; @@ -78,11 +83,13 @@ public: /// Constructor /// \param theParent is a parent of the property panel /// \param theMgr operation manager - XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr); + XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop); // Destructor virtual ~XGUI_InspectionPanel(); +protected: + virtual void showEvent(QShowEvent* theEvent); private slots: /// A slot to react on selection changed @@ -172,20 +179,27 @@ private: /// \param theBox the box void setRotatedBoxType(const QString& theTitle, const std::shared_ptr& theBox); - /// Set text into parameters area /// \param theText the text void setParamsText(const QString& theText); + /// Fills Feature panel with controls specific to the given feature + /// \param theFeature the selected feature + void buildFeaturePane(const FeaturePtr& theFeature); + private: - XGUI_SelectionMgr* mySelectionMgr; //> selection manager - - QLineEdit* myNameEdt; //> Name field - QTableWidget* mySubShapesTab; //> table of sub-shapes - QLabel* myTypeLbl; //> label of a type - QTextBrowser* myTypeParams; //> parameters area - QVBoxLayout* myMainLayout; //> main layout - //QWidget* myMainWidget; //> main widget + XGUI_Workshop* myWorkshop; //> selection manager + + QLineEdit* myNameEdt; ///> Name field + QTableWidget* mySubShapesTab; ///> table of sub-shapes + QLabel* myTypeLbl; ///> label of a type + QTextBrowser* myTypeParams; ///> parameters area + QVBoxLayout* myMainLayout; ///> main layout + ModuleBase_PageWidget* myFeaturePane; ///> Content of feature property panel + QGridLayout* myFeatureLayout; ///> Layout of feature panel + QStackedWidget* myStackWgt; ///> base widget of the panel + int myShapePanelId; + int myFeaturePanelId; }; #endif \ No newline at end of file diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 17d4f6d59..b7c1a65bc 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -106,6 +106,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { + myLastSelectionPlace = ModuleBase_ISelection::Browser; QList aSelectedPrs = myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); @@ -138,6 +139,7 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { + myLastSelectionPlace = ModuleBase_ISelection::Viewer; QList aValues; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 1a4e519b3..6b7adae6b 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -57,6 +57,10 @@ Q_OBJECT return mySelection; } + ModuleBase_ISelection::SelectionPlace placeOfSelection() const { + return myLastSelectionPlace; + } + //! Connects the manager to all viewers accessible by Workshop void connectViewers(); @@ -111,6 +115,8 @@ private: /// Current selection object XGUI_Selection* mySelection; + + ModuleBase_ISelection::SelectionPlace myLastSelectionPlace; }; #endif diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 3dce31965..9b7166a14 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -710,8 +710,8 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) myPropertyPanel->cleanContent(); QList aWidgets; - if (!module()->createWidgets(theOperation, aWidgets)) { - QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); + QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); + if (!module()->createWidgets(aFOperation->feature(), aXmlRepr, aWidgets)) { ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myModuleConnector); aFactory.createWidget(myPropertyPanel->contentWidget()); aWidgets = aFactory.getModelWidgets(); @@ -1531,7 +1531,7 @@ void XGUI_Workshop::createDockWidgets() Qt::BottomDockWidgetArea); connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed())); - myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector); + myInspectionPanel = new XGUI_InspectionPanel(aDesktop, this); myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel); -- 2.30.2