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_ImmersibleZoneDlg.h"
21 #include "HYDROGUI_Tool.h"
28 HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
29 : HYDROGUI_BasicZoneDlg( theModule, theTitle,
30 tr( "ZONE_NAME" ), tr( "NAME" ),
31 tr( "ZONE_PARAMETERS" ), tr( "ZONE_BATHYMETRY" ) )
33 myPolylines = new QComboBox( myPolylineFrame );
34 myPolylines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
36 QBoxLayout* aPolyLayout = new QHBoxLayout( myPolylineFrame );
37 aPolyLayout->setMargin( 0 );
38 aPolyLayout->setSpacing( 5 );
39 aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), myPolylineFrame ) );
40 aPolyLayout->addWidget( myPolylines );
42 QBoxLayout* aParamLayout = new QVBoxLayout( myParamGroup );
43 aParamLayout->setMargin( 5 );
44 aParamLayout->setSpacing( 5 );
45 aParamLayout->addWidget( myPolylineFrame );
47 // Connect signals and slots
48 connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
51 HYDROGUI_ImmersibleZoneDlg::~HYDROGUI_ImmersibleZoneDlg()
55 void HYDROGUI_ImmersibleZoneDlg::reset()
57 bool isBlocked = blockSignals( true );
59 HYDROGUI_BasicZoneDlg::reset();
63 blockSignals( isBlocked );
68 void HYDROGUI_ImmersibleZoneDlg::setPolylineNames( const QStringList& thePolylines )
70 bool isBlocked = blockSignals( true );
73 myPolylines->addItems( thePolylines );
75 blockSignals( isBlocked );
78 void HYDROGUI_ImmersibleZoneDlg::setPolylineName( const QString& theName )
80 int aNewIdx = myPolylines->findText( theName );
81 if ( aNewIdx != myPolylines->currentIndex() )
83 myPolylines->setCurrentIndex( aNewIdx );
91 QString HYDROGUI_ImmersibleZoneDlg::getPolylineName() const
93 return myPolylines->currentText();
96 void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
98 if ( signalsBlocked() )
101 QString aPolylineName = getPolylineName();
102 emit CreatePreview( aPolylineName );