#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 )
{
}
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() ) {
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() ) )
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() )
{
{
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:
return QString();
}
QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
- QWidget* /*parent*/) const
+ QWidget* /*parent*/,
+ const int /*index*/) const
{
return 0;
}
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() );
myHelpFileName = "";
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
-
}
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
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()
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;
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
const ListOfWidgets& widgets() const;
ListOfWidgets& changeWidgets();
+ QtxDialog* dlg() const { return myDlg; }
virtual QFrame* buildFrame () = 0;
QFrame* buildStdFrame ();
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;
QString myHypType;
ListOfWidgets myParamWidgets;
bool myIsCreate;
+ QtxDialog* myDlg;
};
class SMESHGUI_HypothesisDlg : public QtxDialog
protected slots:
virtual void accept();
+ virtual void reject();
void onHelp();
private: