From 942d70ff346d9d7c3279b3e74406f949ff5d333d Mon Sep 17 00:00:00 2001 From: skv Date: Mon, 13 Oct 2014 12:14:17 +0400 Subject: [PATCH] Change base class from MeasureGUI_Skeleton to GEOMBase_Skeleton --- .../MeasureGUI_CheckSelfIntersectionsDlg.cxx | 63 +++++++++++++++++-- .../MeasureGUI_CheckSelfIntersectionsDlg.h | 19 ++++-- 2 files changed, 72 insertions(+), 10 deletions(-) diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx index 8debf294c..11d27b7ef 100644 --- a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx @@ -26,6 +26,7 @@ #include "MeasureGUI_CheckSelfIntersectionsDlg.h" #include "MeasureGUI_Widgets.h" +#include #include #include #include @@ -52,7 +53,7 @@ // true to construct a modal dialog. //================================================================================= MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent) - : MeasureGUI_Skeleton(GUI, parent, false) + : GEOMBase_Skeleton(GUI, parent, false) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS"))); @@ -63,6 +64,10 @@ MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (Geom /***************************************************************/ mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS")); mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); myGrp = new MeasureGUI_1Sel1TextView2ListBox (centralWidget()); myGrp->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS")); @@ -107,12 +112,60 @@ MeasureGUI_CheckSelfIntersectionsDlg::~MeasureGUI_CheckSelfIntersectionsDlg() //================================================================================= void MeasureGUI_CheckSelfIntersectionsDlg::Init() { - mySelBtn = myGrp->PushButton1; - mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init(); - + connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()), SLOT(onErrorsListSelectionChanged())); connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()), SLOT(onSubShapesListSelectionChanged())); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr MeasureGUI_CheckSelfIntersectionsDlg::createOperation() +{ + return getGeomEngine()->GetIMeasureOperations( getStudyId() ); +} + +//================================================================================= +// function : SetEditCurrentArgument +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::SetEditCurrentArgument() +{ + myGrp->LineEdit1->setFocus(); + SelectionIntoArgument(); +} + +//================================================================================= +// function : SelectionIntoArgument +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument() +{ + myObj = GEOM::GEOM_Object::_nil(); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); + + if (aSelList.Extent() > 0) { + aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + } + + if (aSelectedObject->_is_nil()) { + myGrp->LineEdit1->setText(""); + processObject(); + erasePreview(); + return; + } + + myObj = aSelectedObject; + myGrp->LineEdit1->setText(GEOMBase::GetName(myObj)); + processObject(); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h index e22346439..00104a6d9 100644 --- a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h @@ -26,7 +26,7 @@ #ifndef MEASUREGUI_CHECKSELFINTERDLG_H #define MEASUREGUI_CHECKSELFINTERDLG_H -#include +#include class MeasureGUI_1Sel1TextView2ListBox; @@ -35,29 +35,38 @@ class MeasureGUI_1Sel1TextView2ListBox; // purpose : //================================================================================= -class MeasureGUI_CheckSelfIntersectionsDlg : public MeasureGUI_Skeleton +class MeasureGUI_CheckSelfIntersectionsDlg : public GEOMBase_Skeleton { Q_OBJECT public: + MeasureGUI_CheckSelfIntersectionsDlg(GeometryGUI*, QWidget*); ~MeasureGUI_CheckSelfIntersectionsDlg(); protected: - // redefined from GEOMBase_Helper and MeasureGUI_Skeleton - virtual void processObject(); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + + void processObject(); private slots: + void onErrorsListSelectionChanged(); void onSubShapesListSelectionChanged(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); private: + void Init(); private: - MeasureGUI_1Sel1TextView2ListBox* myGrp; + MeasureGUI_1Sel1TextView2ListBox* myGrp; + GEOM::GEOM_Object_var myObj; GEOM::ListOfLong_var myInters; + }; #endif // MEASUREGUI_CHECKSELFINTERDLG_H -- 2.39.2