1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROGUI_TranslateObstacleDlg.h"
21 #include <QtxDoubleSpinBox.h>
26 #include <QGridLayout>
30 HYDROGUI_TranslateObstacleDlg::HYDROGUI_TranslateObstacleDlg( HYDROGUI_Module* theModule, const QString& theTitle )
31 : HYDROGUI_InputPanel( theModule, theTitle )
34 QGroupBox* aNameGroup = new QGroupBox( tr( "OBSTACLE_NAME" ), this );
36 QLabel* aNameLabel = new QLabel( tr( "NAME" ), aNameGroup );
37 myName = new QLineEdit( aNameGroup );
38 myName->setEnabled( false );
40 QBoxLayout* aNameLayout = new QHBoxLayout( aNameGroup );
41 aNameLayout->setMargin( 5 );
42 aNameLayout->setSpacing( 5 );
43 aNameLayout->addWidget( aNameLabel );
44 aNameLayout->addWidget( myName );
46 // Translation arguments
47 QGroupBox* anArgGroup = new QGroupBox( tr( "TRANSLATION_ARGUMENTS" ), this );
49 QLabel* aDxLabel = new QLabel( tr( "DX" ), anArgGroup );
50 myDxSpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
52 QLabel* aDyLabel = new QLabel( tr( "DY" ), anArgGroup );
53 myDySpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
55 QLabel* aDzLabel = new QLabel( tr( "DZ" ), anArgGroup );
56 myDzSpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
58 QGridLayout* anArgLayout = new QGridLayout( anArgGroup );
59 anArgLayout->setMargin( 5 );
60 anArgLayout->setSpacing( 5 );
62 anArgLayout->addWidget( aDxLabel, 0, 0 );
63 anArgLayout->addWidget( myDxSpin, 0, 1 );
64 anArgLayout->addWidget( aDyLabel, 1, 0 );
65 anArgLayout->addWidget( myDySpin, 1, 1 );
66 anArgLayout->addWidget( aDzLabel, 2, 0 );
67 anArgLayout->addWidget( myDzSpin, 2, 1 );
70 addWidget( aNameGroup );
71 addWidget( anArgGroup );
74 // Connect signals and slots
75 connect( myDxSpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
76 connect( myDySpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
77 connect( myDzSpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
80 HYDROGUI_TranslateObstacleDlg::~HYDROGUI_TranslateObstacleDlg()
84 void HYDROGUI_TranslateObstacleDlg::reset()
88 myDxSpin->setValue( 0 );
89 myDySpin->setValue( 0 );
90 myDzSpin->setValue( 0 );
93 void HYDROGUI_TranslateObstacleDlg::setName( const QString& theName )
95 myName->setText( theName );
98 double HYDROGUI_TranslateObstacleDlg::getDx() const
100 return myDxSpin->value();
103 double HYDROGUI_TranslateObstacleDlg::getDy() const
105 return myDySpin->value();
108 double HYDROGUI_TranslateObstacleDlg::getDz() const
110 return myDzSpin->value();