1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "MEDGUIDataBaseDockWidget.hxx"
22 #include "CAM_Application.h"
23 #include "SUIT_ResourceMgr.h"
25 #include <QTreeWidget>
26 #include <QHeaderView>
27 #include <QGridLayout>
29 MEDGUIDataBaseDockWidget::MEDGUIDataBaseDockWidget(CAM_Application *app, QWidget * parent):QDockWidget(parent),_app(app)
31 setWindowTitle("MEDUtils DataBase");
33 setMinimumHeight(300);
34 QWidget *content = new QWidget;
36 QGridLayout *gridLayout1 = new QGridLayout(content);
37 _tree_widget=new QTreeWidget(content);
38 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
39 QTreeWidgetItem *item1 = new QTreeWidgetItem;
40 item1->setText(0, QString::fromUtf8("Name"));
41 _tree_widget->setHeaderItem(item1);
42 sizePolicy.setHeightForWidth(_tree_widget->sizePolicy().hasHeightForWidth());
43 _tree_widget->setSizePolicy(sizePolicy);
44 _tree_widget->setMinimumSize(QSize(0, 0));
45 _tree_widget->setSizeIncrement(QSize(0, 0));
46 _tree_widget->header()->setCascadingSectionResizes(true);
47 gridLayout1->addWidget(_tree_widget,0,0,1,1);
50 SUIT_ResourceMgr* mgr=_app->resourceMgr();
51 pixmap=mgr->loadPixmap("MED","med_field.png");
52 _fields=new QTreeWidgetItem((QTreeWidget*)0,QStringList(QString("Fields")));
53 _fields->setIcon(0,QIcon(pixmap));
54 _tree_widget->addTopLevelItem(_fields);
55 pixmap=mgr->loadPixmap("MED","med_mesh.png");
56 _meshes=new QTreeWidgetItem((QTreeWidget*)0,QStringList(QString("Meshes")));
57 _meshes->setIcon(0,QIcon(pixmap));
58 _tree_widget->addTopLevelItem(_meshes);
61 void MEDGUIDataBaseDockWidget::appendFieldLT(const std::vector<ParaMEDMEM::MEDCalculatorBrowserLiteStruct>& lts)