From: eap Date: Fri, 7 Jun 2013 07:32:59 +0000 (+0000) Subject: 0021952: Add an option to write planar meshes as 3D meshes in MED files X-Git-Tag: B4KillOfAutomake~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1d8dda87bd34c07a9cdd5dd8dbbf76d9c6ac415f;p=modules%2Fgui.git 0021952: Add an option to write planar meshes as 3D meshes in MED files Enable several check-boxes --- diff --git a/src/SalomeApp/SalomeApp_CheckFileDlg.cxx b/src/SalomeApp/SalomeApp_CheckFileDlg.cxx index 8ecb6b4bb..a4bbff88c 100644 --- a/src/SalomeApp/SalomeApp_CheckFileDlg.cxx +++ b/src/SalomeApp/SalomeApp_CheckFileDlg.cxx @@ -36,19 +36,44 @@ SUIT_FileDlg( parent, open, showQuickDir, modal ) QGridLayout* grid = ::qobject_cast( layout() ); if ( grid ) { - myCheckBox = new QCheckBox( theCheckBoxName, this ); - QLabel* label = new QLabel("", this); - QPushButton* pb = new QPushButton(this); - + QCheckBox* myCheckBox = new QCheckBox( theCheckBoxName, this ); + QLabel* label = new QLabel("", this); + QPushButton* pb = new QPushButton(this); + myCheckBoxes.append( myCheckBox ); + int row = grid->rowCount(); grid->addWidget( label, row, 0 ); grid->addWidget( myCheckBox, row, 1 ); grid->addWidget( pb, row, 2 ); - + pb->hide(); } } +/*! +Constructor +*/ +SalomeApp_CheckFileDlg::SalomeApp_CheckFileDlg( QWidget* parent, bool open, const QStringList& theCheckBoxNames, bool showQuickDir, bool modal) : +SUIT_FileDlg( parent, open, showQuickDir, modal ) +{ + if ( theCheckBoxNames.count() > 0 ) + { + + QGridLayout* grid = ::qobject_cast( layout() ); + if ( grid ) + { + for ( int i = 0; i < theCheckBoxNames.count(); ++i ) + { + QCheckBox* myCheckBox = new QCheckBox( theCheckBoxNames.at(i), this ); + myCheckBoxes.append( myCheckBox ); + + int row = grid->rowCount(); + grid->addWidget( myCheckBox, row, 1 ); + } + } + } +} + /*! Destructor */ @@ -58,15 +83,18 @@ SalomeApp_CheckFileDlg::~SalomeApp_CheckFileDlg() } /*!Sets checked.*/ -void SalomeApp_CheckFileDlg::SetChecked( bool check ) +void SalomeApp_CheckFileDlg::SetChecked( bool check, int checkBoxId/*=0*/ ) { - myCheckBox->setChecked(check); + if ( checkBoxId >=0 && checkBoxId < myCheckBoxes.count() ) + myCheckBoxes.at( checkBoxId )->setChecked(check); } /*!Is checked? *\retval boolean - true, check box is checked, else false. */ -bool SalomeApp_CheckFileDlg::IsChecked() const +bool SalomeApp_CheckFileDlg::IsChecked( int checkBoxId ) const { - return myCheckBox->isChecked(); + if ( checkBoxId >=0 && checkBoxId < myCheckBoxes.count() ) + return myCheckBoxes.at( checkBoxId )->isChecked(); + return false; } diff --git a/src/SalomeApp/SalomeApp_CheckFileDlg.h b/src/SalomeApp/SalomeApp_CheckFileDlg.h index 85c75a280..f6578c546 100644 --- a/src/SalomeApp/SalomeApp_CheckFileDlg.h +++ b/src/SalomeApp/SalomeApp_CheckFileDlg.h @@ -35,14 +35,15 @@ class SALOMEAPP_EXPORT SalomeApp_CheckFileDlg : public SUIT_FileDlg public: SalomeApp_CheckFileDlg( QWidget*, bool open, const QString& theCheckBoxName, bool showQuickDir = true, bool modal = true ); + SalomeApp_CheckFileDlg( QWidget*, bool open, const QStringList& theCheckBoxNames, bool showQuickDir = true, bool modal = true ); virtual ~SalomeApp_CheckFileDlg(); public: - void SetChecked( bool check ); - bool IsChecked() const; + void SetChecked( bool check, int checkBoxId=0 ); + bool IsChecked(int checkBoxId=0) const; protected: - QCheckBox* myCheckBox; + QList< QCheckBox* > myCheckBoxes; }; #endif