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
SET(_moc_HEADERS
MeasureGUI.h
MeasureGUI_Widgets.h
MeasureGUI_Skeleton.h
MeasureGUI_PropertiesDlg.h

View File

@ -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
//=====================================================================================

View File

@ -29,6 +29,8 @@
#include <GEOMGUI.h>
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

View File

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

View File

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

View File

@ -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<QWidget*>( 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<QWidget*>( 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();
}

View File

@ -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