1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_ZLevelsDlg.h"
25 #include "HYDROGUI_OrderedListWidget.h"
26 #include "HYDROGUI_Module.h"
27 #include "HYDROGUI_ListSelector.h"
29 #include "LightApp_Application.h"
30 #include "LightApp_SelectionMgr.h"
34 #include <QPushButton>
39 @param theParent the parent widget
41 HYDROGUI_ZLevelsDlg::HYDROGUI_ZLevelsDlg( QWidget* theParent, HYDROGUI_Module* theModule )
42 : QDialog( theParent )
45 setWindowTitle( tr( "CHANGE_LAYER_ORDER" ) );
48 QVBoxLayout* aMainLayout = new QVBoxLayout( this );
49 aMainLayout->setMargin( 5 );
50 aMainLayout->setSpacing( 5 );
52 // Ordered list widget
53 myListWidget = new HYDROGUI_OrderedListWidget( this );
55 // "All objects" check box
56 myAllObjects = new QCheckBox( tr( "ALL_OBJECTS" ) );
58 // Apply and close buttons
59 myApply = new QPushButton( tr("APPLY") );
60 myApply->setDefault( true );
61 myClose = new QPushButton( tr("CLOSE") );
64 // apply and close buttons
65 QHBoxLayout* aDlgButtonsLayout = new QHBoxLayout();
66 aDlgButtonsLayout->addWidget( myApply );
67 aDlgButtonsLayout->addWidget( myClose );
68 aDlgButtonsLayout->addStretch();
70 aMainLayout->addWidget( myListWidget );
71 aMainLayout->addWidget( myAllObjects );
72 aMainLayout->addLayout( aDlgButtonsLayout );
75 connect( myAllObjects, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChanged() ) );
77 connect( myApply, SIGNAL( clicked() ), this, SIGNAL( applyOrder() ) );
78 connect( myClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
85 HYDROGUI_ListSelector* aListSelector =
86 new HYDROGUI_ListSelector( myListWidget, theModule->getApp()->selectionMgr() );
87 aListSelector->setAutoBlock( true );
94 HYDROGUI_ZLevelsDlg::~HYDROGUI_ZLevelsDlg()
99 Set the list of objects (which supposed to be ordered by the dialog).
100 @param theObjects the list of objects
102 void HYDROGUI_ZLevelsDlg::setObjects( const HYDROGUI_ListModel::Object2VisibleList& theObjects )
104 myListWidget->setObjects( theObjects );
108 Returns the ordered list of objects.
109 @return the list of objects
111 QList<Handle(HYDROData_Entity)> HYDROGUI_ZLevelsDlg::getObjects() const
113 return myListWidget->getObjects();
117 Slot called on "All objects" check box state change.
119 void HYDROGUI_ZLevelsDlg::onStateChanged()
121 bool isAll = myAllObjects->isChecked();
122 myListWidget->setHiddenObjectsShown( isAll );