summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b6766b8)
1) now dlg of MESHGUI_GenericHypothesisCreator is non modal
2) make MESHGUI_GenericHypothesisCreator::dlg() work
#include <qpixmap.h>
#include <qgroupbox.h>
#include <qpixmap.h>
#include <qgroupbox.h>
+#include <qapplication.h>
+
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& aHypType )
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 );
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 )
{
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() );
- 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() ) {
if( res ) {
QString paramValues = storeParams();
if ( !paramValues.isEmpty() ) {
SMESH::SetValue( SHyp, paramValues );
}
}
SMESH::SetValue( SHyp, paramValues );
}
}
changeWidgets().clear();
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
return res;
}
changeWidgets().clear();
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
return res;
}
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
{
if( CORBA::is_nil( hypothesis() ) )
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
{
if( CORBA::is_nil( hypothesis() ) )
QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
GroupC1Layout->addWidget( lab, i, 0 );
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() )
{
if ( !w )
switch( (*anIt).myValue.type() )
{
{
QString valueStr = "";
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
{
QString valueStr = "";
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
for( int i=0; param!=aLast; param++, i++ )
{
for( int i=0; param!=aLast; param++, i++ )
{
+ if ( valueStr.length() > len0 ) {
+ len0 = valueStr.length();
+ }
switch( (*param).myValue.type() )
{
case QVariant::Int:
switch( (*param).myValue.type() )
{
case QVariant::Int:
return QString();
}
QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
return QString();
}
QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
- QWidget* /*parent*/) const
+ QWidget* /*parent*/,
+ const int /*index*/) const
+void SMESHGUI_GenericHypothesisCreator::onReject()
+{
+}
+
SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
-: QtxDialog( parent, "", true, true ),
+: QtxDialog( parent, "", false, true ),
myCreator( creator )
{
setMinimumSize( 300, height() );
myCreator( creator )
{
setMinimumSize( 300, height() );
myHelpFileName = "";
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
myHelpFileName = "";
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
}
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
}
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
void SMESHGUI_HypothesisDlg::accept()
{
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 SMESHGUI_HypothesisDlg::onHelp()
void create( const bool isAlgo, QWidget* );
void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
void create( SMESH::SMESH_Hypothesis_ptr, QWidget* );
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 bool checkParams() const = 0;
+ virtual void onReject();
QString hypType() const;
bool isCreation() const;
QString hypType() const;
bool isCreation() const;
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
const ListOfWidgets& widgets() const;
ListOfWidgets& changeWidgets();
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
const ListOfWidgets& widgets() const;
ListOfWidgets& changeWidgets();
+ QtxDialog* dlg() const { return myDlg; }
virtual QFrame* buildFrame () = 0;
QFrame* buildStdFrame ();
virtual QFrame* buildFrame () = 0;
QFrame* buildStdFrame ();
bool getStdParamFromDlg( ListOfStdParams& ) const;
static QString stdParamValues( const ListOfStdParams& );
virtual void attuneStdWidget( QWidget*, const int ) const;
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;
virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
virtual QString caption() const;
virtual QPixmap icon() const;
QString myHypType;
ListOfWidgets myParamWidgets;
bool myIsCreate;
QString myHypType;
ListOfWidgets myParamWidgets;
bool myIsCreate;
};
class SMESHGUI_HypothesisDlg : public QtxDialog
};
class SMESHGUI_HypothesisDlg : public QtxDialog
protected slots:
virtual void accept();
protected slots:
virtual void accept();