mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 02:30:33 +05:00
PAL13473 (Build repetitive mesh):
1) now dlg of MESHGUI_GenericHypothesisCreator is non modal 2) make MESHGUI_GenericHypothesisCreator::dlg() work
This commit is contained in:
parent
b6766b8ebd
commit
8860097b4b
@ -43,9 +43,10 @@
|
||||
#include <qpixmap.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& aHypType )
|
||||
: myHypType( aHypType ),
|
||||
myIsCreate( false )
|
||||
: myHypType( aHypType ), myIsCreate( false ), myDlg( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@ -131,17 +132,22 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
||||
bool res = true;
|
||||
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
||||
|
||||
SMESHGUI_HypothesisDlg* Dlg =
|
||||
new SMESHGUI_HypothesisDlg( const_cast<SMESHGUI_GenericHypothesisCreator*>( this ), parent );
|
||||
myDlg = Dlg;
|
||||
QFrame* fr = buildFrame();
|
||||
if( fr )
|
||||
{
|
||||
SMESHGUI_HypothesisDlg* dlg =
|
||||
new SMESHGUI_HypothesisDlg( const_cast<SMESHGUI_GenericHypothesisCreator*>( this ), parent );
|
||||
dlg->setCustomFrame( fr );
|
||||
dlg->setCaption( caption() );
|
||||
dlg->setHIcon( icon() );
|
||||
dlg->setType( type() );
|
||||
Dlg->setCustomFrame( fr );
|
||||
Dlg->setCaption( caption() );
|
||||
Dlg->setHIcon( icon() );
|
||||
Dlg->setType( type() );
|
||||
retrieveParams();
|
||||
res = dlg->exec()==QDialog::Accepted;
|
||||
Dlg->show();
|
||||
//connect(myDlg, SIGNAL( closed() ), this, SLOT( onDlgClosed() ));
|
||||
qApp->enter_loop(); // make myDlg not modal
|
||||
// res = myDlg->exec()==QDialog::Accepted;
|
||||
res = myDlg->result();
|
||||
if( res ) {
|
||||
QString paramValues = storeParams();
|
||||
if ( !paramValues.isEmpty() ) {
|
||||
@ -149,14 +155,14 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
||||
SMESH::SetValue( SHyp, paramValues );
|
||||
}
|
||||
}
|
||||
delete dlg;
|
||||
}
|
||||
delete Dlg; myDlg = 0;
|
||||
changeWidgets().clear();
|
||||
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
{
|
||||
if( CORBA::is_nil( hypothesis() ) )
|
||||
@ -187,7 +193,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
|
||||
GroupC1Layout->addWidget( lab, i, 0 );
|
||||
|
||||
QWidget* w = getCustomWidget( *anIt, GroupC1 );
|
||||
QWidget* w = getCustomWidget( *anIt, GroupC1, i );
|
||||
if ( !w )
|
||||
switch( (*anIt).myValue.type() )
|
||||
{
|
||||
@ -283,10 +289,13 @@ QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams
|
||||
{
|
||||
QString valueStr = "";
|
||||
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
|
||||
uint len0 = 0;
|
||||
for( int i=0; param!=aLast; param++, i++ )
|
||||
{
|
||||
if ( i > 0 )
|
||||
if ( valueStr.length() > len0 ) {
|
||||
valueStr += "; ";
|
||||
len0 = valueStr.length();
|
||||
}
|
||||
switch( (*param).myValue.type() )
|
||||
{
|
||||
case QVariant::Int:
|
||||
@ -357,7 +366,8 @@ QString SMESHGUI_GenericHypothesisCreator::type() const
|
||||
return QString();
|
||||
}
|
||||
QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
|
||||
QWidget* /*parent*/) const
|
||||
QWidget* /*parent*/,
|
||||
const int /*index*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -366,11 +376,15 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam& , QW
|
||||
return false;
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::onReject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
|
||||
: QtxDialog( parent, "", true, true ),
|
||||
: QtxDialog( parent, "", false, true ),
|
||||
myCreator( creator )
|
||||
{
|
||||
setMinimumSize( 300, height() );
|
||||
@ -414,7 +428,6 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato
|
||||
myHelpFileName = "";
|
||||
|
||||
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
|
||||
|
||||
}
|
||||
|
||||
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
|
||||
@ -432,8 +445,17 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
||||
|
||||
void SMESHGUI_HypothesisDlg::accept()
|
||||
{
|
||||
if( !myCreator || myCreator->checkParams() )
|
||||
QtxDialog::accept();
|
||||
if ( myCreator && !myCreator->checkParams() )
|
||||
return;
|
||||
QtxDialog::accept();
|
||||
qApp->exit_loop();
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::reject()
|
||||
{
|
||||
if ( myCreator ) myCreator->onReject();
|
||||
QtxDialog::reject();
|
||||
qApp->exit_loop();
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::onHelp()
|
||||
|
@ -51,7 +51,9 @@ public:
|
||||
void create( const bool isAlgo, QWidget* );
|
||||
void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||
void create( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||
|
||||
virtual bool checkParams() const = 0;
|
||||
virtual void onReject();
|
||||
|
||||
QString hypType() const;
|
||||
bool isCreation() const;
|
||||
@ -71,6 +73,7 @@ protected:
|
||||
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
|
||||
const ListOfWidgets& widgets() const;
|
||||
ListOfWidgets& changeWidgets();
|
||||
QtxDialog* dlg() const { return myDlg; }
|
||||
|
||||
virtual QFrame* buildFrame () = 0;
|
||||
QFrame* buildStdFrame ();
|
||||
@ -80,7 +83,7 @@ protected:
|
||||
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
||||
static QString stdParamValues( const ListOfStdParams& );
|
||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||
virtual QWidget* getCustomWidget( const StdParam &, QWidget* ) const;
|
||||
virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const;
|
||||
virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
|
||||
virtual QString caption() const;
|
||||
virtual QPixmap icon() const;
|
||||
@ -97,6 +100,7 @@ private:
|
||||
QString myHypType;
|
||||
ListOfWidgets myParamWidgets;
|
||||
bool myIsCreate;
|
||||
QtxDialog* myDlg;
|
||||
};
|
||||
|
||||
class SMESHGUI_HypothesisDlg : public QtxDialog
|
||||
@ -113,6 +117,7 @@ public:
|
||||
|
||||
protected slots:
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
void onHelp();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user