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 myParamsTreeWd = new QTreeWidget( frame );
53 myParamsTreeWd->setColumnCount( 2 );
54 myParamsTreeWd->setHeaderLabels( QStringList() << tr( "PARAMETER" ) << tr( "VALUE" ) );
55 myParamsTreeWd->header()->setStretchLastSection( true );
56 myParamsTreeWd->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
58 QHBoxLayout* operationLay = new QHBoxLayout( operationGB );
59 operationLay->addWidget( myIconLbl );
60 operationLay->addWidget( myOperaionLnEd );
61 operationLay->setMargin(5);
63 QVBoxLayout* aLayout = new QVBoxLayout( frame );
64 aLayout->addWidget( operationGB );
65 aLayout->addWidget( myParamsTreeWd );
67 // get a free dockable window id
69 while( app->dockWindow( myWindowID ))
73 void GEOMGUI_CreationInfoWdg::setOperation(const QPixmap& icon, const QString& name)
75 myIconLbl->setPixmap( icon );
76 myOperaionLnEd->setText( name );
77 myParamsTreeWd->clear();
80 myOperaionLnEd->setText( tr("NO_INFO"));
83 void GEOMGUI_CreationInfoWdg::addParam (const QString& name, const QString& value)
85 QTreeWidgetItem* item = new QTreeWidgetItem( myParamsTreeWd );
87 item->setFlags( item->flags() | Qt::ItemIsEditable );
88 item->setExpanded( true );
90 item->setText( 0, name );
91 item->setText( 1, value );
94 void GEOMGUI_CreationInfoWdg::clear()
96 myIconLbl->setPixmap( QPixmap() );
97 myOperaionLnEd->setText( "" );
98 myParamsTreeWd->clear();
101 GEOMGUI_CreationInfoWdg::~GEOMGUI_CreationInfoWdg()
103 std::cout<<"~GEOMGUI_CreationInfoWdg"<<std::endl;