1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_EditScalarBarDlg.cxx
25 // Author : Nicolas REJNERI
30 #include "SMESHGUI_EditScalarBarDlg.h"
36 #include <qlineedit.h>
37 #include <qpushbutton.h>
41 #include <qwhatsthis.h>
44 * Constructs a SMESHGUI_EditScalarBarDlg which is a child of 'parent', with the
45 * name 'name' and widget flags set to 'f'
47 * The dialog will by default be modeless, unless you set 'modal' to
48 * TRUE to construct a modal dialog.
50 SMESHGUI_EditScalarBarDlg::SMESHGUI_EditScalarBarDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
51 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
54 setName( "SMESHGUI_EditScalarBarDlg" );
56 setCaption( tr( "SMESH_SCALARBAR" ) );
57 setSizeGripEnabled( TRUE );
58 grid = new QGridLayout( this );
59 grid->setSpacing( 6 );
60 grid->setMargin( 11 );
62 grid_2 = new QGridLayout;
63 grid_2->setSpacing( 6 );
64 grid_2->setMargin( 0 );
66 PushButtonUpdateView = new QPushButton( this, "PushButtonUpdateView" );
67 PushButtonUpdateView->setText( tr( "SMESH_UPDATEVIEW" ) );
69 grid_2->addWidget( PushButtonUpdateView, 1, 0 );
71 grid_3 = new QGridLayout;
72 grid_3->setSpacing( 6 );
73 grid_3->setMargin( 0 );
75 grid_4 = new QGridLayout;
76 grid_4->setSpacing( 6 );
77 grid_4->setMargin( 0 );
79 grid_5 = new QGridLayout;
80 grid_5->setSpacing( 6 );
81 grid_5->setMargin( 0 );
83 LineEditMax = new QLineEdit( this, "LineEditMax" );
85 grid_5->addWidget( LineEditMax, 0, 0 );
87 LineEditMin = new QLineEdit( this, "LineEditMin" );
89 grid_5->addWidget( LineEditMin, 1, 0 );
91 grid_4->addLayout( grid_5, 0, 1 );
93 grid_6 = new QGridLayout;
94 grid_6->setSpacing( 6 );
95 grid_6->setMargin( 0 );
97 TextLabelMax = new QLabel( this, "TextLabelMax" );
98 TextLabelMax->setText( tr( "SMESH_MAX" ) );
100 grid_6->addWidget( TextLabelMax, 0, 0 );
102 TextLabelMin = new QLabel( this, "TextLabelMin" );
103 TextLabelMin->setText( tr( "SMESH_MIN" ) );
105 grid_6->addWidget( TextLabelMin, 1, 0 );
107 grid_4->addLayout( grid_6, 0, 0 );
109 grid_3->addLayout( grid_4, 0, 0 );
111 Line1 = new QFrame( this, "Line1" );
112 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
114 grid_3->addWidget( Line1, 1, 0 );
116 grid_2->addLayout( grid_3, 0, 0 );
118 grid->addLayout( grid_2, 0, 0 );
120 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
121 if ( mySMESHGUI && mySMESHGUI->GetScalarBar() && mySMESHGUI->GetScalarBar()->GetLookupTable() ) {
122 float *range = mySMESHGUI->GetScalarBar()->GetLookupTable()->GetRange();
123 LineEditMin->setText( QString("%1").arg(range[0]) );
124 LineEditMax->setText( QString("%1").arg(range[1]) );
127 // signals and slots connections
128 connect( PushButtonUpdateView, SIGNAL( clicked() ), this, SLOT( updateView() ) );
129 /* to close dialog if study change */
130 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ) ;
134 * Destroys the object and frees any allocated resources
136 SMESHGUI_EditScalarBarDlg::~SMESHGUI_EditScalarBarDlg()
138 // no need to delete child widgets, Qt does it all for us
141 void SMESHGUI_EditScalarBarDlg::updateView()
143 float MinRange = LineEditMin->text().toFloat();
144 float MaxRange = LineEditMax->text().toFloat();
145 mySMESHGUI->UpdateScalarBar(MinRange,MaxRange);