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
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"));
42 QFrame* frame = new QFrame( this );
44 QVBoxLayout* myLayout = new QVBoxLayout( this );
45 myLayout->addWidget( frame );
46 myLayout->setMargin(0);
48 QGroupBox* operationGB = new QGroupBox( tr( "OPERATION" ), frame );
50 myIconLbl = new QLabel( operationGB );
51 myOperaionLnEd = new QLineEdit( operationGB );
52 myOperaionLnEd->setReadOnly( true );
53 myParamsTreeWd = new QTreeWidget( frame );
54 myParamsTreeWd->setColumnCount( 2 );
55 myParamsTreeWd->setHeaderLabels( QStringList() << tr( "PARAMETER" ) << tr( "VALUE" ) );
56 myParamsTreeWd->header()->setStretchLastSection( true );
57 myParamsTreeWd->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
59 QHBoxLayout* operationLay = new QHBoxLayout( operationGB );
60 operationLay->addWidget( myIconLbl );
61 operationLay->addWidget( myOperaionLnEd );
62 operationLay->setMargin(5);
64 QVBoxLayout* aLayout = new QVBoxLayout( frame );
65 aLayout->addWidget( operationGB );
66 aLayout->addWidget( myParamsTreeWd );
68 // get a free dockable window id
70 while( app->dockWindow( myWindowID ))
72 ++myWindowID; // pb when a GEOM is a sole module: CreationInfoWdg replaces Python console
75 void GEOMGUI_CreationInfoWdg::setOperation(const QPixmap& icon, const QString& name)
77 myIconLbl->setPixmap( icon );
78 myOperaionLnEd->setText( name );
79 myParamsTreeWd->clear();
82 myOperaionLnEd->setText( tr("NO_INFO"));
85 void GEOMGUI_CreationInfoWdg::addParam (const QString& name, const QString& value)
87 QTreeWidgetItem* item = new QTreeWidgetItem( myParamsTreeWd );
89 //item->setFlags( Qt::NoItemFlags );
90 item->setExpanded( true );
92 item->setText( 0, name );
93 item->setText( 1, value );
96 void GEOMGUI_CreationInfoWdg::clear()
98 myIconLbl->setPixmap( QPixmap() );
99 myOperaionLnEd->setText( "" );
100 myParamsTreeWd->clear();
103 GEOMGUI_CreationInfoWdg::~GEOMGUI_CreationInfoWdg()
105 //std::cout<<"~GEOMGUI_CreationInfoWdg"<<std::endl;