Fix remarks to the "0021854: EDF 2320 GEOM : Add persistent dimensions" issue:

Stay manage dimension dialog opened during creation new dimension.
This commit is contained in:
rnv 2014-02-14 10:45:47 +04:00
parent b93a22e62f
commit c6a5528202
7 changed files with 76 additions and 19 deletions

View File

@ -106,6 +106,7 @@ SET(MeasureGUI_HEADERS
# header files / to be processed by moc # header files / to be processed by moc
SET(_moc_HEADERS SET(_moc_HEADERS
MeasureGUI.h
MeasureGUI_Widgets.h MeasureGUI_Widgets.h
MeasureGUI_Skeleton.h MeasureGUI_Skeleton.h
MeasureGUI_PropertiesDlg.h MeasureGUI_PropertiesDlg.h

View File

@ -61,6 +61,7 @@
//======================================================================= //=======================================================================
MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent ) 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 ); dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
break; // POINT COORDINATES break; // POINT COORDINATES
case GEOMOp::OpManageDimensions: case GEOMOp::OpManageDimensions:
if( !myManageDimensionDlg ) {
dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent ); dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent );
myManageDimensionDlg = dlg;
connect( dlg, SIGNAL( finished(int) ), this, SLOT( onFinished(int) ) );
}
myManageDimensionDlg->activateWindow();
break; // MANAGE DIMENSIONS break; // MANAGE DIMENSIONS
case GEOMOp::OpShowAllDimensions: case GEOMOp::OpShowAllDimensions:
ChangeDimensionsVisibility( true ); ChangeDimensionsVisibility( true );
@ -199,6 +205,16 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible )
GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true ); 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 // EXPORTED METHODS
//===================================================================================== //=====================================================================================

View File

@ -29,6 +29,8 @@
#include <GEOMGUI.h> #include <GEOMGUI.h>
class QDialog;
//================================================================================= //=================================================================================
// class : MeasureGUI // class : MeasureGUI
// purpose : // purpose :
@ -41,6 +43,7 @@ displayPreview(true, false, true, true, w, -1, -1);
class MeasureGUI : public GEOMGUI class MeasureGUI : public GEOMGUI
{ {
Q_OBJECT
public: public:
MeasureGUI( GeometryGUI* ); MeasureGUI( GeometryGUI* );
~MeasureGUI(); ~MeasureGUI();
@ -49,6 +52,10 @@ public:
// Show/hide all dimension created for object // Show/hide all dimension created for object
void ChangeDimensionsVisibility( const bool theIsVisible ); void ChangeDimensionsVisibility( const bool theIsVisible );
private:
QDialog* myManageDimensionDlg;
private slots:
void onFinished(int);
}; };
#endif // MEASUREGUI_H #endif // MEASUREGUI_H

View File

@ -390,7 +390,9 @@ bool MeasureGUI_CreateDimensionDlg::ClickOnApply()
if ( !isApplyAndClose() ) if ( !isApplyAndClose() )
{ {
emit applyClicked();
Init(); Init();
ConstructTypeChanged( getConstructorId() );
} }
return true; return true;

View File

@ -83,6 +83,10 @@ public:
public: public:
void Init(); void Init();
signals:
void applyClicked();
/* User event logics */ /* User event logics */
protected slots: protected slots:
void ConstructTypeChanged( int theType ); void ConstructTypeChanged( int theType );

View File

@ -67,7 +67,8 @@
MeasureGUI_ManageDimensionsDlg::MeasureGUI_ManageDimensionsDlg( GeometryGUI* theGUI, QWidget* theParent ) MeasureGUI_ManageDimensionsDlg::MeasureGUI_ManageDimensionsDlg( GeometryGUI* theGUI, QWidget* theParent )
: GEOMBase_Skeleton( theGUI, theParent ), : GEOMBase_Skeleton( theGUI, theParent ),
myOperatedViewer( NULL ), myOperatedViewer( NULL ),
myCurrentSelection( Selection_None ) myCurrentSelection( Selection_None ),
myCreateDialog(0)
{ {
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
@ -381,20 +382,22 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS
//================================================================================= //=================================================================================
void MeasureGUI_ManageDimensionsDlg::OnAdd() void MeasureGUI_ManageDimensionsDlg::OnAdd()
{ {
if(!myCreateDialog) {
QWidget* aParent = qobject_cast<QWidget*>( this->parent() ); QWidget* aParent = qobject_cast<QWidget*>( this->parent() );
this->Suspend(); this->Suspend();
myCreateDialog = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent );
MeasureGUI_CreateDimensionDlg* aCreateDlg = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent ); connect( myCreateDialog, SIGNAL( finished( int ) ), this, SLOT( Resume() ) );
connect( aCreateDlg, SIGNAL( finished( int ) ), this, SLOT( Resume() ) );
// this is necessary as the GEOMBase_Helper switches selection mode on destruction // this is necessary as the GEOMBase_Helper switches selection mode on destruction
connect( aCreateDlg, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) ); connect( myCreateDialog, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) );
connect( myCreateDialog, SIGNAL( applyClicked() ), this, SLOT( OnDimensionAdded() ) );
aCreateDlg->updateGeometry(); myCreateDialog->updateGeometry();
aCreateDlg->resize( aCreateDlg->minimumSizeHint() ); myCreateDialog->resize( myCreateDialog->minimumSizeHint() );
aCreateDlg->show(); 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() void MeasureGUI_ManageDimensionsDlg::Suspend()
{ {
StopSelection(); StopSelection();
hide();
} }
//================================================================================= //=================================================================================
@ -681,7 +683,12 @@ void MeasureGUI_ManageDimensionsDlg::Suspend()
//================================================================================= //=================================================================================
void MeasureGUI_ManageDimensionsDlg::Resume() void MeasureGUI_ManageDimensionsDlg::Resume()
{ {
this->show(); if(myCreateDialog){
myCreateDialog = 0;
myObjectSelector->setEnabled(true);
myDimensionView->setEnabled(true);
}
if ( !myEditObject.isNull() ) if ( !myEditObject.isNull() )
{ {
PopulateList(); PopulateList();
@ -689,6 +696,17 @@ void MeasureGUI_ManageDimensionsDlg::Resume()
} }
} }
//=================================================================================
// function : Suspend
// purpose :
//=================================================================================
void MeasureGUI_ManageDimensionsDlg::OnDimensionAdded() {
if ( !myEditObject.isNull() )
{
PopulateList();
}
}
//================================================================================= //=================================================================================
// function : ClickOnOk // function : ClickOnOk
// purpose : // purpose :
@ -713,6 +731,11 @@ void MeasureGUI_ManageDimensionsDlg::ClickOnCancel()
return; return;
} }
if( myCreateDialog ) {
myCreateDialog->close();
myCreateDialog = 0;
}
GEOMBase_Skeleton::ClickOnCancel(); GEOMBase_Skeleton::ClickOnCancel();
} }

View File

@ -36,6 +36,7 @@ class DlgRef_1Sel;
class QTreeWidget; class QTreeWidget;
class QPushButton; class QPushButton;
class SOCC_Viewer; class SOCC_Viewer;
class MeasureGUI_CreateDimensionDlg;
//================================================================================= //=================================================================================
// class : MeasureGUI_ManageDimensionsDlg // class : MeasureGUI_ManageDimensionsDlg
@ -81,6 +82,8 @@ protected slots:
void OnFinish(); void OnFinish();
void OnActivateThisDialog(); void OnActivateThisDialog();
void OnDeactivateThisDialog(); void OnDeactivateThisDialog();
void OnDimensionAdded();
/* Utils */ /* Utils */
private: private:
@ -119,6 +122,7 @@ private:
GEOMGUI_DimensionProperty mySavedPropertyState; GEOMGUI_DimensionProperty mySavedPropertyState;
SOCC_Viewer* myOperatedViewer; SOCC_Viewer* myOperatedViewer;
Selection myCurrentSelection; Selection myCurrentSelection;
MeasureGUI_CreateDimensionDlg* myCreateDialog;
}; };
#endif #endif