1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
19 // File : GEOMGUI_CreationInfoWdg.cxx
20 // Created : Fri Jun 7 13:07:59 2013
21 // Author : Edward AGAPOV (eap)
23 #include "GEOMGUI_CreationInfoWdg.h"
25 #include <SalomeApp_Application.h>
26 #include <SUIT_Desktop.h>
31 #include <QTreeWidget>
32 #include <QHeaderView>
34 #include <QVBoxLayout>
35 #include <QHBoxLayout>
37 GEOMGUI_CreationInfoWdg::GEOMGUI_CreationInfoWdg( SalomeApp_Application* app )
38 //:QWidget( app->desktop() )
40 setWindowTitle( tr( "CREATION_INFO_TITLE" ) );
41 setObjectName( "geomCreationInformation" );
43 QFrame* frame = new QFrame( this );
45 QVBoxLayout* myLayout = new QVBoxLayout( this );
46 myLayout->addWidget( frame );
47 myLayout->setMargin(0);
49 QGroupBox* operationGB = new QGroupBox( tr( "OPERATION" ), frame );
51 myIconLbl = new QLabel( operationGB );
52 myOperaionLnEd = new QLineEdit( operationGB );
53 myOperaionLnEd->setReadOnly( true );
54 myParamsTreeWd = new QTreeWidget( frame );
55 myParamsTreeWd->setColumnCount( 2 );
56 myParamsTreeWd->setHeaderLabels( QStringList() << tr( "PARAMETER" ) << tr( "VALUE" ) );
57 myParamsTreeWd->header()->setStretchLastSection( true );
58 myParamsTreeWd->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
60 QHBoxLayout* operationLay = new QHBoxLayout( operationGB );
61 operationLay->addWidget( myIconLbl );
62 operationLay->addWidget( myOperaionLnEd );
63 operationLay->setMargin(5);
65 QVBoxLayout* aLayout = new QVBoxLayout( frame );
66 aLayout->addWidget( operationGB );
67 aLayout->addWidget( myParamsTreeWd );
69 // get a free dockable window id
71 while( app->dockWindow( myWindowID ))
73 ++myWindowID; // pb when a GEOM is a sole module: CreationInfoWdg replaces Python console
76 void GEOMGUI_CreationInfoWdg::setOperation(const QPixmap& icon, const QString& name)
78 myIconLbl->setPixmap( icon );
79 myOperaionLnEd->setText( name );
80 myParamsTreeWd->clear();
83 myOperaionLnEd->setText( tr("NO_INFO"));
86 void GEOMGUI_CreationInfoWdg::addParam (const QString& name, const QString& value)
88 QTreeWidgetItem* item = new QTreeWidgetItem( myParamsTreeWd );
90 //item->setFlags( Qt::NoItemFlags );
91 item->setExpanded( true );
93 item->setText( 0, name );
94 item->setText( 1, value );
97 void GEOMGUI_CreationInfoWdg::clear()
99 myIconLbl->setPixmap( QPixmap() );
100 myOperaionLnEd->setText( "" );
101 myParamsTreeWd->clear();
104 GEOMGUI_CreationInfoWdg::~GEOMGUI_CreationInfoWdg()
106 //std::cout<<"~GEOMGUI_CreationInfoWdg"<<std::endl;