fix bug with "Compute" operation invoked from Preview dialog (The problem that dialog with mesh result info appear and disappear very quickly)

This commit is contained in:
ptv 2009-04-21 11:27:21 +00:00
parent 728f9a0bad
commit 103c6cfb67
2 changed files with 28 additions and 31 deletions

View File

@ -1433,6 +1433,17 @@ SMESHGUI_ComputeDlg* SMESHGUI_BaseComputeOp::computeDlg() const
return myCompDlg; return myCompDlg;
} }
//================================================================================
/*!
* \brief returns from compute mesh result dialog
*/
//================================================================================
bool SMESHGUI_BaseComputeOp::onApply()
{
return true;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Return a table * \brief Return a table
@ -1479,17 +1490,6 @@ void SMESHGUI_ComputeOp::startOperation()
computeMesh(); computeMesh();
} }
//================================================================================
/*!
* \brief perform it's intention action: compute mesh
*/
//================================================================================
bool SMESHGUI_ComputeOp::onApply()
{
return true;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Gets dialog of this operation * \brief Gets dialog of this operation
@ -1559,6 +1559,8 @@ void SMESHGUI_PrecomputeOp::startOperation()
// connect signals // connect signals
connect( myDlg, SIGNAL( preview() ), this, SLOT( onPreview() ) ); connect( myDlg, SIGNAL( preview() ), this, SLOT( onPreview() ) );
connect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onCompute() ) );
connect( myDlg, SIGNAL( dlgApply() ), this, SLOT( onCompute() ) );
} }
myActiveDlg = myDlg; myActiveDlg = myDlg;
@ -1588,6 +1590,10 @@ void SMESHGUI_PrecomputeOp::startOperation()
SMESHGUI_BaseComputeOp::startOperation(); SMESHGUI_BaseComputeOp::startOperation();
// disconnect slot from preview dialog to have Apply from results of compute operation only
disconnect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
disconnect( myDlg, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
myDlg->show(); myDlg->show();
} }
@ -1675,24 +1681,16 @@ void SMESHGUI_PrecomputeOp::initDialog()
//================================================================================ //================================================================================
/*! /*!
* \brief perform it's intention action: * \brief perform it's intention action: compute mesh
*/ */
//================================================================================ //================================================================================
bool SMESHGUI_PrecomputeOp::onApply() void SMESHGUI_PrecomputeOp::onCompute()
{ {
QObject* obj = sender(); myDlg->hide();
if ( obj != myDlg && myActiveDlg == myDlg ) myMapShapeId.clear();
return true; // just return from error messages myActiveDlg = computeDlg();
if ( myActiveDlg == myDlg ) computeMesh();
{
myDlg->hide();
myMapShapeId.clear();
myActiveDlg = computeDlg();
computeMesh();
}
return true;
} }
//================================================================================ //================================================================================
@ -1704,11 +1702,10 @@ bool SMESHGUI_PrecomputeOp::onApply()
void SMESHGUI_PrecomputeOp::onCancel() void SMESHGUI_PrecomputeOp::onCancel()
{ {
QObject* curDlg = sender(); QObject* curDlg = sender();
if ( curDlg == computeDlg() ) if ( curDlg == computeDlg() && myActiveDlg == myDlg )
{ {
if ( myActiveDlg == myDlg ) // return from error messages // return from error messages
myDlg->show(); myDlg->show();
return; return;
} }

View File

@ -84,6 +84,7 @@ protected:
const QString& ); const QString& );
protected slots: protected slots:
virtual bool onApply();
void onPreviewShape(); void onPreviewShape();
void onPublishShape(); void onPublishShape();
void onShowBadMesh(); void onShowBadMesh();
@ -120,7 +121,6 @@ protected:
virtual void startOperation(); virtual void startOperation();
protected slots: protected slots:
virtual bool onApply();
}; };
/*! /*!
@ -144,11 +144,11 @@ protected:
virtual void initDialog(); virtual void initDialog();
protected slots: protected slots:
virtual bool onApply();
virtual void onCancel(); virtual void onCancel();
private slots: private slots:
void onPreview(); void onPreview();
void onCompute();
private: private:
QMap< int, int > myMapShapeId; QMap< int, int > myMapShapeId;