Salome HOME
Merge branch 'BR_H2018_2' of https://codev-tuleap.cea.fr/plugins/git/salome/hydro...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PolyAttrDlg.cxx
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include "HYDROGUI_PolyAttrDlg.h"
20 #include <QVBoxLayout>
21 #include <QPushButton>
22
23 HYDROGUI_PolyAttrDlg::HYDROGUI_PolyAttrDlg( QWidget* theParent, const QStringList& theDBFData )
24   : QDialog( theParent )
25 {
26   QVBoxLayout* aMainLayout = new QVBoxLayout( this );
27   aMainLayout->setMargin(5);
28   aMainLayout->setSpacing(5);
29   int nbcol = theDBFData.size()/2;
30   myDBFDataTable = new QTableWidget(1, nbcol);
31   //myDBFDataTable->setEditTriggers(QAbstractItemView:NoEditTriggers);
32
33   QStringList header;
34   for (int i = 0; i < nbcol; i++)
35     header << theDBFData[i];
36   myDBFDataTable->setHorizontalHeaderLabels(header);
37   myDBFDataTable->setShowGrid(true);
38
39   for (int i = theDBFData.size()/2; i < theDBFData.size(); i++)
40   {
41     QTableWidgetItem* item = new QTableWidgetItem(theDBFData[i]);
42     item->setFlags(item->flags() ^ Qt::ItemIsEditable);
43     myDBFDataTable->setItem(0, i-theDBFData.size()/2, item);
44   }
45
46   aMainLayout->addWidget(myDBFDataTable);
47
48   QPushButton* anOkButton = new QPushButton( tr("OK"), this );
49   anOkButton->setDefault( true ); 
50   aMainLayout->addWidget( anOkButton );
51
52   connect( anOkButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
53
54   setLayout(aMainLayout);  
55
56 }
57
58 HYDROGUI_PolyAttrDlg::~HYDROGUI_PolyAttrDlg()
59 {
60 }
61
62