1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_ConvToQuadDlg.cxx
25 // Author : Open CASCADE S.A.S.
28 #include "SMESHGUI_ConvToQuadDlg.h"
30 #include "SMESHGUI_ConvToQuadOp.h"
35 #include <QRadioButton>
36 #include <QButtonGroup>
39 #include <QHBoxLayout>
40 #include <QGridLayout>
46 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
47 : SMESHGUI_Dialog( 0, false, true )
49 setWindowTitle( tr( "CAPTION" ) );
51 // Create top controls
54 setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
55 createObject( tr( "MESH" ), mainFrame(), 0 );
58 myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() );
61 myBGBox = new QGroupBox( mainFrame() );
62 myBG = new QButtonGroup( mainFrame() );
63 QVBoxLayout* aBGLayout = new QVBoxLayout( myBGBox );
64 aBGLayout->setMargin(MARGIN);
65 aBGLayout->setSpacing(SPACING);
67 myRB2Lin = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
68 myRB2Quad = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
69 myRB2BiQua = new QRadioButton( tr( "RADIOBTN_3" ), myBGBox );
71 aBGLayout->addWidget(myRB2Lin);
72 aBGLayout->addWidget(myRB2Quad);
73 aBGLayout->addWidget(myRB2BiQua);
74 myBG->addButton(myRB2Lin, 0);
75 myBG->addButton(myRB2Quad, 1);
76 myBG->addButton(myRB2BiQua, 2);
77 myRB2Lin->setChecked( true );
79 myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
82 QGridLayout* aLay = new QGridLayout( mainFrame() );
84 aLay->setSpacing( 5 );
86 aLay->addWidget( objectWg( 0, Label ), 0, 0 );
87 aLay->addWidget( objectWg( 0, Btn ), 0, 1 );
88 aLay->addWidget( objectWg( 0, Control ), 0, 2 );
89 aLay->addWidget( myMedNdsOnGeom, 1, 0, 1, 3 );
90 aLay->addWidget( myBGBox, 2, 0, 1, 3 );
91 aLay->addWidget( myWarning, 3, 0, 1, 3 );
93 connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) );
96 SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
100 bool SMESHGUI_ConvToQuadDlg::IsBiQuadratic() const
102 return myRB2BiQua->isChecked();
105 bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
107 return !myMedNdsOnGeom->isChecked();
110 void SMESHGUI_ConvToQuadDlg::SetMediumNdsOnGeom(const bool theCheck)
112 myMedNdsOnGeom->setChecked(theCheck);
115 bool SMESHGUI_ConvToQuadDlg::IsEnabledCheck() const
117 return myMedNdsOnGeom->isEnabled();
120 void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck )
122 myMedNdsOnGeom->setEnabled( theCheck );
125 int SMESHGUI_ConvToQuadDlg::CurrentRB( )
127 return myBG->checkedId();
130 void SMESHGUI_ConvToQuadDlg::ShowWarning(bool toShow)
138 bool SMESHGUI_ConvToQuadDlg::isWarningShown()
140 return myWarning->isVisible();
143 void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
145 //myBGBox->setEnabled( theCheck );
146 myRB2Lin->setEnabled( theCheck );
147 myRB2Quad->setEnabled( theCheck );
148 myRB2BiQua->setEnabled( theCheck );
149 myMedNdsOnGeom->setEnabled( theCheck );
150 //setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
153 void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck )
155 myRB2Lin ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Linear );
156 myRB2Quad ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Quadratic );
157 myRB2BiQua->setEnabled( idx & SMESHGUI_ConvToQuadOp::BiQuadratic );
159 if ( idx & SMESHGUI_ConvToQuadOp::Linear )
161 myRB2Lin->setChecked( true );
162 myRB2Quad->setChecked( false );
166 myRB2Lin->setChecked( false );
167 myRB2Quad->setChecked( true );
169 myRB2BiQua->setChecked( false );
171 myMedNdsOnGeom->setEnabled( theCheck );
173 emit onClicked( myBG->checkedId() );