From: rnv Date: Fri, 14 Feb 2014 06:45:47 +0000 (+0400) Subject: Fix remarks to the "0021854: EDF 2320 GEOM : Add persistent dimensions" issue: X-Git-Tag: V7_4_0a1~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c6a552820220fbbd66371cc5622d74361812f107;p=modules%2Fgeom.git Fix remarks to the "0021854: EDF 2320 GEOM : Add persistent dimensions" issue: Stay manage dimension dialog opened during creation new dimension. --- diff --git a/src/MeasureGUI/CMakeLists.txt b/src/MeasureGUI/CMakeLists.txt index 2c6a39430..f0366daf7 100755 --- a/src/MeasureGUI/CMakeLists.txt +++ b/src/MeasureGUI/CMakeLists.txt @@ -106,6 +106,7 @@ SET(MeasureGUI_HEADERS # header files / to be processed by moc SET(_moc_HEADERS + MeasureGUI.h MeasureGUI_Widgets.h MeasureGUI_Skeleton.h MeasureGUI_PropertiesDlg.h diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index dea595628..b9220a040 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -61,6 +61,7 @@ //======================================================================= MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { + myManageDimensionDlg = 0; } //======================================================================= @@ -128,7 +129,12 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent ); break; // POINT COORDINATES case GEOMOp::OpManageDimensions: - dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent ); + if( !myManageDimensionDlg ) { + dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent ); + myManageDimensionDlg = dlg; + connect( dlg, SIGNAL( finished(int) ), this, SLOT( onFinished(int) ) ); + } + myManageDimensionDlg->activateWindow(); break; // MANAGE DIMENSIONS case GEOMOp::OpShowAllDimensions: ChangeDimensionsVisibility( true ); @@ -199,6 +205,16 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible ) GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true ); } +//======================================================================= +// function : onFinished +// purpose : called then "Manage Dimension" dialog is closed. +//======================================================================= +void MeasureGUI::onFinished(int /*theResult*/) { + if(sender() == myManageDimensionDlg) { + myManageDimensionDlg = 0; + } +} + //===================================================================================== // EXPORTED METHODS //===================================================================================== diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h index fc909da1d..c11a60970 100644 --- a/src/MeasureGUI/MeasureGUI.h +++ b/src/MeasureGUI/MeasureGUI.h @@ -29,6 +29,8 @@ #include +class QDialog; + //================================================================================= // class : MeasureGUI // purpose : @@ -41,6 +43,7 @@ displayPreview(true, false, true, true, w, -1, -1); class MeasureGUI : public GEOMGUI { + Q_OBJECT public: MeasureGUI( GeometryGUI* ); ~MeasureGUI(); @@ -49,6 +52,10 @@ public: // Show/hide all dimension created for object void ChangeDimensionsVisibility( const bool theIsVisible ); +private: + QDialog* myManageDimensionDlg; +private slots: + void onFinished(int); }; #endif // MEASUREGUI_H diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index f36834a17..199545066 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -390,7 +390,9 @@ bool MeasureGUI_CreateDimensionDlg::ClickOnApply() if ( !isApplyAndClose() ) { + emit applyClicked(); Init(); + ConstructTypeChanged( getConstructorId() ); } return true; diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.h b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.h index 28293277a..90a344628 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.h +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.h @@ -83,6 +83,10 @@ public: public: void Init(); + +signals: + void applyClicked(); + /* User event logics */ protected slots: void ConstructTypeChanged( int theType ); diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index 9433464b1..2b20b5d0a 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -67,7 +67,8 @@ MeasureGUI_ManageDimensionsDlg::MeasureGUI_ManageDimensionsDlg( GeometryGUI* theGUI, QWidget* theParent ) : GEOMBase_Skeleton( theGUI, theParent ), myOperatedViewer( NULL ), - myCurrentSelection( Selection_None ) + myCurrentSelection( Selection_None ), + myCreateDialog(0) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); @@ -381,20 +382,22 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS //================================================================================= void MeasureGUI_ManageDimensionsDlg::OnAdd() { - QWidget* aParent = qobject_cast( this->parent() ); - - this->Suspend(); - - MeasureGUI_CreateDimensionDlg* aCreateDlg = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent ); - - connect( aCreateDlg, SIGNAL( finished( int ) ), this, SLOT( Resume() ) ); - - // this is necessary as the GEOMBase_Helper switches selection mode on destruction - connect( aCreateDlg, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) ); - - aCreateDlg->updateGeometry(); - aCreateDlg->resize( aCreateDlg->minimumSizeHint() ); - aCreateDlg->show(); + if(!myCreateDialog) { + QWidget* aParent = qobject_cast( this->parent() ); + this->Suspend(); + myCreateDialog = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent ); + connect( myCreateDialog, SIGNAL( finished( int ) ), this, SLOT( Resume() ) ); + // this is necessary as the GEOMBase_Helper switches selection mode on destruction + connect( myCreateDialog, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) ); + connect( myCreateDialog, SIGNAL( applyClicked() ), this, SLOT( OnDimensionAdded() ) ); + myCreateDialog->updateGeometry(); + myCreateDialog->resize( myCreateDialog->minimumSizeHint() ); + myCreateDialog->show(); + } else { + myCreateDialog->activateWindow(); + } + myObjectSelector->setEnabled(false); + myDimensionView->setEnabled(false); } //================================================================================= @@ -672,7 +675,6 @@ void MeasureGUI_ManageDimensionsDlg::OnInteractionFinished( Handle(AIS_Interacti void MeasureGUI_ManageDimensionsDlg::Suspend() { StopSelection(); - hide(); } //================================================================================= @@ -681,7 +683,12 @@ void MeasureGUI_ManageDimensionsDlg::Suspend() //================================================================================= void MeasureGUI_ManageDimensionsDlg::Resume() { - this->show(); + if(myCreateDialog){ + myCreateDialog = 0; + myObjectSelector->setEnabled(true); + myDimensionView->setEnabled(true); + } + if ( !myEditObject.isNull() ) { PopulateList(); @@ -689,6 +696,17 @@ void MeasureGUI_ManageDimensionsDlg::Resume() } } +//================================================================================= +// function : Suspend +// purpose : +//================================================================================= +void MeasureGUI_ManageDimensionsDlg::OnDimensionAdded() { + if ( !myEditObject.isNull() ) + { + PopulateList(); + } +} + //================================================================================= // function : ClickOnOk // purpose : @@ -712,7 +730,12 @@ void MeasureGUI_ManageDimensionsDlg::ClickOnCancel() { return; } - + + if( myCreateDialog ) { + myCreateDialog->close(); + myCreateDialog = 0; + } + GEOMBase_Skeleton::ClickOnCancel(); } diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.h b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.h index 91a28978f..d575a6d89 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.h +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.h @@ -36,6 +36,7 @@ class DlgRef_1Sel; class QTreeWidget; class QPushButton; class SOCC_Viewer; +class MeasureGUI_CreateDimensionDlg; //================================================================================= // class : MeasureGUI_ManageDimensionsDlg @@ -81,6 +82,8 @@ protected slots: void OnFinish(); void OnActivateThisDialog(); void OnDeactivateThisDialog(); + void OnDimensionAdded(); + /* Utils */ private: @@ -119,6 +122,7 @@ private: GEOMGUI_DimensionProperty mySavedPropertyState; SOCC_Viewer* myOperatedViewer; Selection myCurrentSelection; + MeasureGUI_CreateDimensionDlg* myCreateDialog; }; #endif