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_ImportLandCoverDlg.h"
21 #include <SUIT_MessageBox.h>
24 #include <QListWidget>
25 #include <QVBoxLayout>
27 #include <QPushButton>
29 HYDROGUI_ImportLandCoverDlg::HYDROGUI_ImportLandCoverDlg( std::vector<SHPObject*> theSHPObjects, std::map<QListWidgetItem*, SHPObject*>& theWItemToSObjectMap, QWidget* theParent )
30 : QtxDialog( theParent, false, true, QtxDialog::YesNo )
32 setWindowTitle( tr( "IMPORT_LANDCOVER_OBJECTS" ) );
33 setButtonPosition( Left, Yes );
34 setButtonPosition( Right, No );
36 QLabel* anIconLabelLabel = new QLabel( mainFrame() );
37 anIconLabelLabel->setPixmap( SUIT_MessageBox::standardIcon( QMessageBox::Question ) );
38 anIconLabelLabel->setScaledContents( false );
39 anIconLabelLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
41 myObjectsLabel = new QLabel( tr( "CONFIRM_SELECTION" ), mainFrame() );
43 myListW = new QListWidget(mainFrame());
44 for (int i = 1 ; i <= theSHPObjects.size(); i++)
46 myListW->addItem("Polygon_" + QString::number(i));
48 myListW->setSelectionMode(QAbstractItemView::ExtendedSelection);
50 QGridLayout* aLayout = new QGridLayout( mainFrame() );
51 aLayout->setMargin( 5 );
52 aLayout->setSpacing( 5 );
53 aLayout->addWidget( anIconLabelLabel, 0, 0 );
54 aLayout->addWidget( myObjectsLabel, 0, 1 );
56 aLayout->addWidget( myListW, 1, 0, 1, 2 );
58 if ( QPushButton* aYesBtn = ::qobject_cast<QPushButton*>( button( Yes ) ) )
60 setFocusProxy( aYesBtn );
61 aYesBtn->setAutoDefault( true );
62 aYesBtn->setDefault( true );
64 if ( QPushButton* aNoBtn = ::qobject_cast<QPushButton*>( button( No ) ) )
66 aNoBtn->setAutoDefault( true );
69 setMinimumSize( 350, 450 );
72 HYDROGUI_ImportLandCoverDlg::~HYDROGUI_ImportLandCoverDlg()
76 QList<QListWidgetItem*> HYDROGUI_ImportLandCoverDlg::GetSelectedItems()
78 return myListW->selectedItems();