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_TransparencyDlg.h"
21 #include <QtxDoubleSpinBox.h>
25 #include <QPushButton>
27 const double RANGE = 1;
28 const double STEP = 0.1;
29 const double PREC = 2;
33 @param theParent the parent widget
35 HYDROGUI_TransparencyDlg::HYDROGUI_TransparencyDlg( QWidget* theParent )
36 : QDialog( theParent )
38 myTransparency = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, this );
39 myTransparency->setValue( 0.5 );
41 // Apply and close buttons
42 myApplyAndClose = new QPushButton( tr("APPLY_AND_CLOSE") );
43 myApplyAndClose->setDefault( true );
44 myApply = new QPushButton( tr("APPLY") );
45 myClose = new QPushButton( tr("CLOSE") );
49 QHBoxLayout* aLayout = new QHBoxLayout();
50 aLayout->setMargin( 5 );
51 aLayout->setSpacing( 5 );
52 aLayout->addWidget( new QLabel( tr( "TRANSPARENCY" ), this ) );
53 aLayout->addWidget( myTransparency );
54 // Apply and close buttons layout
55 QHBoxLayout* aDlgButtonsLayout = new QHBoxLayout();
56 aDlgButtonsLayout->addWidget( myApplyAndClose );
57 aDlgButtonsLayout->addWidget( myApply );
58 aDlgButtonsLayout->addWidget( myClose );
59 aDlgButtonsLayout->addStretch();
61 QVBoxLayout* aMainLayout = new QVBoxLayout( this );
62 aMainLayout->setMargin( 5 );
63 aMainLayout->setSpacing( 5 );
64 aMainLayout->addLayout( aLayout );
65 aMainLayout->addLayout( aDlgButtonsLayout );
68 connect( myApplyAndClose, SIGNAL( clicked() ), this, SIGNAL( applyAndClose() ) );
69 connect( myApply, SIGNAL( clicked() ), this, SIGNAL( apply() ) );
70 connect( myClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
72 setFixedSize( 300, 90 );
78 HYDROGUI_TransparencyDlg::~HYDROGUI_TransparencyDlg()
82 void HYDROGUI_TransparencyDlg::setTransparency( const double& theValue )
84 myTransparency->setValue( theValue );
87 double HYDROGUI_TransparencyDlg::getTransparency() const
89 return myTransparency->value();