X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ConvToQuadDlg.cxx;h=6ceca1063f786ecf07462f4cdb83f6aabc0199dc;hp=1f53247815e630d92b9369b231ddb57e5311723d;hb=d1ed915c6868c000dc9125ac68641c92c0961349;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258 diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx index 1f5324781..6ceca1063 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx @@ -1,83 +1,107 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_ConvToQuadDlg.cxx -* Module : SMESH -*/ - -#include -#include - -#include -#include -#include -#include -#include + +// SMESH SMESHGUI : GUI for SMESH component +// File : SMESHGUI_ConvToQuadDlg.cxx +// Author : Open CASCADE S.A.S. +// SMESH includes +// +#include "SMESHGUI_ConvToQuadDlg.h" + +#include "SMESHGUI_ConvToQuadOp.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg() -: SMESHGUI_Dialog( 0, false, true ) + : SMESHGUI_Dialog( 0, false, true ) { - - setCaption( tr( "CAPTION" ) ); + setWindowTitle( tr( "CAPTION" ) ); // Create top controls - QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, mainFrame() ); - aGrp->setFrameStyle( QFrame::NoFrame ); - aGrp->setInsideMargin( 0 ); // mesh - createObject( tr( "MESH" ), aGrp, 0 ); + setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) ); + createObject( tr( "MESH" ), mainFrame(), 0 ); //Create check box - myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() ); + myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() ); //Create RadioButtons - myBG = new QButtonGroup( 2, Qt::Vertical, "", mainFrame() ); - myBG->setExclusive( true ); + myBGBox = new QGroupBox( mainFrame() ); + myBG = new QButtonGroup( mainFrame() ); + QVBoxLayout* aBGLayout = new QVBoxLayout( myBGBox ); + aBGLayout->setMargin(MARGIN); + aBGLayout->setSpacing(SPACING); - myRB1 = new QRadioButton( myBG ); - myRB1->setText( tr( "RADIOBTN_1" ) ); - myRB1->setChecked( true ); + myRB2Lin = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox ); + myRB2Quad = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox ); + myRB2BiQua = new QRadioButton( tr( "RADIOBTN_3" ), myBGBox ); - myRB2 = new QRadioButton( myBG ); - myRB2->setText( tr( "RADIOBTN_2" ) ); + aBGLayout->addWidget(myRB2Lin); + aBGLayout->addWidget(myRB2Quad); + aBGLayout->addWidget(myRB2BiQua); + myBG->addButton(myRB2Lin, 0); + myBG->addButton(myRB2Quad, 1); + myBG->addButton(myRB2BiQua, 2); + myRB2Lin->setChecked( true ); + + myWarning = new QLabel(QString("%1").arg(tr("NON_CONFORM_WARNING")), mainFrame()); // Fill layout - QVBoxLayout* aLay = new QVBoxLayout( mainFrame(), 5, 5 ); - aLay->addWidget( aGrp ); - aLay->addWidget( myMedNdsOnGeom ); - aLay->addWidget( myBG ); + QGridLayout* aLay = new QGridLayout( mainFrame() ); + aLay->setMargin( 5 ); + aLay->setSpacing( 5 ); + + aLay->addWidget( objectWg( 0, Label ), 0, 0 ); + aLay->addWidget( objectWg( 0, Btn ), 0, 1 ); + aLay->addWidget( objectWg( 0, Control ), 0, 2 ); + aLay->addWidget( myMedNdsOnGeom, 1, 0, 1, 3 ); + aLay->addWidget( myBGBox, 2, 0, 1, 3 ); + aLay->addWidget( myWarning, 3, 0, 1, 3 ); - connect(myBG, SIGNAL( clicked( int ) ), this, SIGNAL( onClicked( int ) ) ); + connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) ); } SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg() { } +bool SMESHGUI_ConvToQuadDlg::IsBiQuadratic() const +{ + return myRB2BiQua->isChecked(); +} + bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const { return !myMedNdsOnGeom->isChecked(); @@ -100,31 +124,51 @@ void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck ) int SMESHGUI_ConvToQuadDlg::CurrentRB( ) { - return myBG->selectedId(); + return myBG->checkedId(); +} + +void SMESHGUI_ConvToQuadDlg::ShowWarning(bool toShow) +{ + if ( toShow ) + myWarning->show(); + else + myWarning->hide(); +} + +bool SMESHGUI_ConvToQuadDlg::isWarningShown() +{ + return myWarning->isVisible(); } void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck ) { - myBG->setEnabled( theCheck ); + //myBGBox->setEnabled( theCheck ); + myRB2Lin->setEnabled( theCheck ); + myRB2Quad->setEnabled( theCheck ); + myRB2BiQua->setEnabled( theCheck ); myMedNdsOnGeom->setEnabled( theCheck ); - setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply ); + //setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply ); } void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck ) { - if(idx) + myRB2Lin ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Linear ); + myRB2Quad ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Quadratic ); + myRB2BiQua->setEnabled( idx & SMESHGUI_ConvToQuadOp::BiQuadratic ); + + if ( idx & SMESHGUI_ConvToQuadOp::Linear ) { - myRB2->setEnabled( theCheck ); - myRB1->setEnabled( !theCheck ); - myRB1->setChecked( true ); + myRB2Lin->setChecked( true ); + myRB2Quad->setChecked( false ); } else { - myRB1->setEnabled( theCheck ); - myRB2->setEnabled( !theCheck ); - myRB2->setChecked( true ); + myRB2Lin->setChecked( false ); + myRB2Quad->setChecked( true ); } - emit onClicked( myBG->selectedId() ); -} + myRB2BiQua->setChecked( false ); + myMedNdsOnGeom->setEnabled( theCheck ); + emit onClicked( myBG->checkedId() ); +}