2 // File : SMESHGUI_EditScalarBarDlg.cxx
3 // Created : Wed Jun 12 12:01:26 2002
4 // Author : Nicolas REJNERI
8 // Copyright : Open CASCADE 2002
11 #include "SMESHGUI_EditScalarBarDlg.h"
17 #include <qlineedit.h>
18 #include <qpushbutton.h>
22 #include <qwhatsthis.h>
25 * Constructs a SMESHGUI_EditScalarBarDlg which is a child of 'parent', with the
26 * name 'name' and widget flags set to 'f'
28 * The dialog will by default be modeless, unless you set 'modal' to
29 * TRUE to construct a modal dialog.
31 SMESHGUI_EditScalarBarDlg::SMESHGUI_EditScalarBarDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
32 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
35 setName( "SMESHGUI_EditScalarBarDlg" );
37 setCaption( tr( "SMESH_SCALARBAR" ) );
38 setSizeGripEnabled( TRUE );
39 grid = new QGridLayout( this );
40 grid->setSpacing( 6 );
41 grid->setMargin( 11 );
43 grid_2 = new QGridLayout;
44 grid_2->setSpacing( 6 );
45 grid_2->setMargin( 0 );
47 PushButtonUpdateView = new QPushButton( this, "PushButtonUpdateView" );
48 PushButtonUpdateView->setText( tr( "SMESH_UPDATEVIEW" ) );
50 grid_2->addWidget( PushButtonUpdateView, 1, 0 );
52 grid_3 = new QGridLayout;
53 grid_3->setSpacing( 6 );
54 grid_3->setMargin( 0 );
56 grid_4 = new QGridLayout;
57 grid_4->setSpacing( 6 );
58 grid_4->setMargin( 0 );
60 grid_5 = new QGridLayout;
61 grid_5->setSpacing( 6 );
62 grid_5->setMargin( 0 );
64 LineEditMax = new QLineEdit( this, "LineEditMax" );
66 grid_5->addWidget( LineEditMax, 0, 0 );
68 LineEditMin = new QLineEdit( this, "LineEditMin" );
70 grid_5->addWidget( LineEditMin, 1, 0 );
72 grid_4->addLayout( grid_5, 0, 1 );
74 grid_6 = new QGridLayout;
75 grid_6->setSpacing( 6 );
76 grid_6->setMargin( 0 );
78 TextLabelMax = new QLabel( this, "TextLabelMax" );
79 TextLabelMax->setText( tr( "SMESH_MAX" ) );
81 grid_6->addWidget( TextLabelMax, 0, 0 );
83 TextLabelMin = new QLabel( this, "TextLabelMin" );
84 TextLabelMin->setText( tr( "SMESH_MIN" ) );
86 grid_6->addWidget( TextLabelMin, 1, 0 );
88 grid_4->addLayout( grid_6, 0, 0 );
90 grid_3->addLayout( grid_4, 0, 0 );
92 Line1 = new QFrame( this, "Line1" );
93 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
95 grid_3->addWidget( Line1, 1, 0 );
97 grid_2->addLayout( grid_3, 0, 0 );
99 grid->addLayout( grid_2, 0, 0 );
101 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
102 if ( mySMESHGUI && mySMESHGUI->GetScalarBar() && mySMESHGUI->GetScalarBar()->GetLookupTable() ) {
103 float *range = mySMESHGUI->GetScalarBar()->GetLookupTable()->GetRange();
104 LineEditMin->setText( QString("%1").arg(range[0]) );
105 LineEditMax->setText( QString("%1").arg(range[1]) );
108 // signals and slots connections
109 connect( PushButtonUpdateView, SIGNAL( clicked() ), this, SLOT( updateView() ) );
110 /* to close dialog if study change */
111 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ) ;
115 * Destroys the object and frees any allocated resources
117 SMESHGUI_EditScalarBarDlg::~SMESHGUI_EditScalarBarDlg()
119 // no need to delete child widgets, Qt does it all for us
122 void SMESHGUI_EditScalarBarDlg::updateView()
124 float MinRange = LineEditMin->text().toFloat();
125 float MaxRange = LineEditMax->text().toFloat();
126 mySMESHGUI->UpdateScalarBar(MinRange,MaxRange);