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_PolyAttrDlg.h"
20 #include <QVBoxLayout>
21 #include <QPushButton>
23 HYDROGUI_PolyAttrDlg::HYDROGUI_PolyAttrDlg( QWidget* theParent, const QStringList& theDBFData )
24 : QDialog( theParent )
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);
34 for (int i = 0; i < nbcol; i++)
35 header << theDBFData[i];
36 myDBFDataTable->setHorizontalHeaderLabels(header);
37 myDBFDataTable->setShowGrid(true);
39 for (int i = theDBFData.size()/2; i < theDBFData.size(); i++)
41 QTableWidgetItem* item = new QTableWidgetItem(theDBFData[i]);
42 item->setFlags(item->flags() ^ Qt::ItemIsEditable);
43 myDBFDataTable->setItem(0, i-theDBFData.size()/2, item);
46 aMainLayout->addWidget(myDBFDataTable);
48 QPushButton* anOkButton = new QPushButton( tr("OK"), this );
49 anOkButton->setDefault( true );
50 aMainLayout->addWidget( anOkButton );
52 connect( anOkButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
54 setLayout(aMainLayout);
58 HYDROGUI_PolyAttrDlg::~HYDROGUI_PolyAttrDlg()