1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : MeasureGUI_WhatisDlg.cxx
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
26 #include "MeasureGUI_WhatisDlg.h"
27 #include "MeasureGUI_Widgets.h"
31 #include <SUIT_Session.h>
32 #include <SUIT_ResourceMgr.h>
33 #include <SalomeApp_Tools.h>
37 //=================================================================================
38 // class : MeasureGUI_WhatisDlg( )
39 // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the
40 // name 'name' and widget flags set to 'f'.
41 // The dialog will by default be modeless, unless you set 'modal' to
42 // true to construct a modal dialog.
43 //=================================================================================
44 MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( GeometryGUI* GUI, QWidget* parent )
45 : MeasureGUI_Skeleton( GUI, parent )
47 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
48 "GEOM", tr( "ICON_DLG_WHATIS" ) ) );
49 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
50 "GEOM", tr( "ICON_SELECT" ) ) );
52 setWindowTitle( tr( "GEOM_WHATIS_TITLE" ) );
54 /***************************************************************/
56 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_WHATIS" ) );
57 mainFrame()->RadioButton1->setIcon( image0 );
59 myGrp = new MeasureGUI_1Sel1TextView( centralWidget() );
60 myGrp->GroupBox1->setTitle( tr( "GEOM_WHATIS_OBJECT" ) );
61 myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
62 myGrp->TextView1->setReadOnly( true );
64 // fix height to fit all text
65 myGrp->TextView1->setLineWrapMode( QTextEdit::NoWrap );
66 // myGrp->TextView1->setTextFormat( Qt::PlainText ); // VSR : TODO
67 QString allLines ("\n\n\n\n\n\n\n\n\n"); // 10 lines
68 myGrp->TextView1->setText( allLines );
69 int sbHeight = myGrp->TextView1->horizontalScrollBar()->height();
70 myGrp->TextView1->setFixedHeight( myGrp->TextView1->document()->size().height() + sbHeight );
72 myGrp->PushButton1->setIcon( image1 );
73 myGrp->LineEdit1->setReadOnly( true );
75 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
76 layout->setMargin( 0 ); layout->setSpacing( 6 );
77 layout->addWidget( myGrp );
79 /***************************************************************/
81 myHelpFileName = "using_measurement_tools_page.html#whatis_anchor";
88 //=================================================================================
89 // function : ~MeasureGUI_WhatisDlg()
90 // purpose : Destroys the object and frees any allocated resources
91 //=================================================================================
92 MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg()
97 //=================================================================================
100 //=================================================================================
101 void MeasureGUI_WhatisDlg::Init()
103 mySelBtn = myGrp->PushButton1;
104 mySelEdit = myGrp->LineEdit1;
105 MeasureGUI_Skeleton::Init();
108 //=================================================================================
109 // function : processObject
111 //=================================================================================
112 void MeasureGUI_WhatisDlg::processObject()
115 myGrp->TextView1->setText( getParameters( aText ) ? aText : QString( "" ) );
119 //=================================================================================
120 // function : getParameters
122 //=================================================================================
123 bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
125 if ( myObj->_is_nil() )
129 theText = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->WhatIs( myObj );
131 catch( const SALOME::SALOME_Exception& e ) {
132 SalomeApp_Tools::QtCatchCorbaException( e );
136 return getOperation()->IsDone();