Porting to Qt4.

This commit is contained in:
mkr 2007-07-05 12:15:04 +00:00
parent 1fc8a3403c
commit ce0079c088
9 changed files with 207 additions and 170 deletions

View File

@ -29,33 +29,32 @@
#include "GEOMToolsGUI.h" #include "GEOMToolsGUI.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h" #include "GEOMBase.h"
#include "GEOM_Operation.h" #include "GEOM_Operation.h"
#include "GEOM_Displayer.h" #include "GEOM_Displayer.h"
#include <SUIT_Session.h> #include <SUIT_Session.h>
#include <SUIT_Application.h> //#include <SUIT_Application.h>
#include <SUIT_OverrideCursor.h> #include <SUIT_OverrideCursor.h>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
#include <SUIT_Tools.h> #include <SUIT_Tools.h>
#include <SUIT_FileDlg.h> #include <SUIT_FileDlg.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <SUIT_ViewModel.h> #include <SUIT_ViewModel.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx> #include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_Prs.h> #include <SALOME_Prs.h>
#include "utilities.h"
// QT Includes // QT Includes
#include <qapplication.h> #include <QApplication>
#include <qmap.h> #include <QMap>
// OCCT Includes // OCCT Includes
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
@ -83,13 +82,13 @@ static QString getFileName( QWidget* parent,
SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true ); SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );
if ( !caption.isEmpty() ) if ( !caption.isEmpty() )
fd->setCaption( caption ); fd->setWindowTitle( caption );
if ( !initial.isEmpty() ) if ( !initial.isEmpty() )
fd->setSelection( initial ); fd->selectFile( initial );
if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) )
fd->setSelectedFilter( lastUsedFilter ); fd->selectFilter( lastUsedFilter );
fd->setFilters( filters ); fd->setFilters( filters );
@ -280,10 +279,10 @@ void GEOMToolsGUI::OnEditDelete()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warning ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
@ -294,31 +293,32 @@ void GEOMToolsGUI::OnEditDelete()
QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) ); QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) );
if ( parentComp != geomComp ) { if ( parentComp != geomComp ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warning ( app->desktop(),
QObject::tr("ERR_ERROR"), QObject::tr("ERR_ERROR"),
QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ), QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
// VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish
if ( SUIT_MessageBox::warn2( app->desktop(), if ( SUIT_MessageBox::warning( app->desktop(),
QObject::tr( "GEOM_WRN_WARNING" ), QObject::tr( "GEOM_WRN_WARNING" ),
QObject::tr( "GEOM_REALLY_DELETE" ), QObject::tr( "GEOM_REALLY_DELETE" ),
QObject::tr( "GEOM_BUT_YES" ), QObject::tr( "GEOM_BUT_YES" ),
QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 ) QObject::tr( "GEOM_BUT_NO" ), 1 ) != 0 )
return; return;
// QAD_Operation* op = new SALOMEGUI_ImportOperation(.....); // QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
// op->start(); // op->start();
// prepare list of SALOME_Views // prepare list of SALOME_Views
QPtrList<SALOME_View> views; QList<SALOME_View*> views;
SALOME_View* view; SALOME_View* view;
// fill the list // fill the list
ViewManagerList vmans = app->viewManagers(); ViewManagerList vmans = app->viewManagers();
SUIT_ViewManager* vman; SUIT_ViewManager* vman;
for ( vman = vmans.first(); vman; vman = vmans.next() ) { QListIterator<SUIT_ViewManager*> it( vmans );
while ( it.hasNext() && (vman = it.next()) ) {
SUIT_ViewModel* vmod = vman->getViewModel(); SUIT_ViewModel* vmod = vman->getViewModel();
view = dynamic_cast<SALOME_View*> ( vmod ); // must work for OCC and VTK views view = dynamic_cast<SALOME_View*> ( vmod ); // must work for OCC and VTK views
if ( view ) if ( view )
@ -439,19 +439,19 @@ bool GEOMToolsGUI::Import()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warning ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) { if ( CORBA::is_nil( eng ) ) {
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::critical( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr( "GEOM Engine is not started" ), QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
@ -478,7 +478,7 @@ bool GEOMToolsGUI::Import()
{ {
// Trying to detect file type // Trying to detect file type
QFileInfo aFileInfo( fileName ); QFileInfo aFileInfo( fileName );
QString aPossibleType = (aFileInfo.extension(false)).upper() ; QString aPossibleType = (aFileInfo.suffix()).toUpper() ;
if ( (aMap.values()).contains(aPossibleType) ) if ( (aMap.values()).contains(aPossibleType) )
fileType = aPossibleType; fileType = aPossibleType;
@ -495,8 +495,8 @@ bool GEOMToolsGUI::Import()
anOp->start(); anOp->start();
CORBA::String_var fileN = fileName.latin1(); CORBA::String_var fileN = fileName.toLatin1().data();
CORBA::String_var fileT = fileType.latin1(); CORBA::String_var fileT = fileType.toLatin1().data();
anObj = aInsOp->Import(fileN, fileT); anObj = aInsOp->Import(fileN, fileT);
if ( !anObj->_is_nil() && aInsOp->IsDone() ) { if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
@ -507,7 +507,7 @@ bool GEOMToolsGUI::Import()
GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy, GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
SALOMEDS::SObject::_nil(), SALOMEDS::SObject::_nil(),
anObj, anObj,
aPublishObjName); aPublishObjName.toStdString().c_str());
GEOM_Displayer( stud ).Display( anObj.in() ); GEOM_Displayer( stud ).Display( anObj.in() );
@ -519,10 +519,10 @@ bool GEOMToolsGUI::Import()
else { else {
anOp->abort(); anOp->abort();
wc.suspend(); wc.suspend();
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::critical( app->desktop(),
QObject::tr( "GEOM_ERROR" ), QObject::tr( "GEOM_ERROR" ),
QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
} }
} }
catch( const SALOME::SALOME_Exception& S_ex ) { catch( const SALOME::SALOME_Exception& S_ex ) {
@ -555,10 +555,10 @@ bool GEOMToolsGUI::Export()
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) { if ( CORBA::is_nil( eng ) ) {
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::critical( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr( "GEOM Engine is not started" ), QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
@ -607,7 +607,7 @@ bool GEOMToolsGUI::Export()
anOp->start(); anOp->start();
aInsOp->Export( anObj, file, fileType.latin1() ); aInsOp->Export( anObj, file.toStdString().c_str(), fileType.toLatin1().constData() );
if ( aInsOp->IsDone() ) if ( aInsOp->IsDone() )
anOp->commit(); anOp->commit();
@ -615,10 +615,10 @@ bool GEOMToolsGUI::Export()
{ {
anOp->abort(); anOp->abort();
wc.suspend(); wc.suspend();
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::critical( app->desktop(),
QObject::tr( "GEOM_ERROR" ), QObject::tr( "GEOM_ERROR" ),
QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
} }
@ -677,7 +677,7 @@ QString GEOMToolsGUI::getParentComponent( _PTR( SObject ) obj )
//===================================================================================== //=====================================================================================
void GEOMToolsGUI::RemoveObjectWithChildren(_PTR(SObject) obj, void GEOMToolsGUI::RemoveObjectWithChildren(_PTR(SObject) obj,
_PTR(Study) aStudy, _PTR(Study) aStudy,
QPtrList<SALOME_View> views, QList<SALOME_View*> views,
GEOM_Displayer* disp) GEOM_Displayer* disp)
{ {
// iterate through all children of obj // iterate through all children of obj
@ -699,11 +699,11 @@ void GEOMToolsGUI::RemoveObjectWithChildren(_PTR(SObject) obj,
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if (!CORBA::is_nil(geomObj)) { if (!CORBA::is_nil(geomObj)) {
// Erase graphical object // Erase graphical object
SALOME_View* view = views.first(); QListIterator<SALOME_View*> it( views );
for (; view; view = views.next()) { while ( it.hasNext() )
disp->Erase(geomObj, true, view); if ( SALOME_View* view = it.next() )
} disp->Erase(geomObj, true, view);
// Remove object from Engine // Remove object from Engine
GeometryGUI::GetGeomGen()->RemoveObject( geomObj ); GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
} }
@ -732,10 +732,10 @@ bool GEOMToolsGUI::CheckSubObjectInUse(_PTR(SObject) checkobj,
SalomeApp_Application* app = SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warning ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("DEP_OBJECT"), QObject::tr("DEP_OBJECT"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return true; return true;
} }
} }

View File

@ -32,16 +32,14 @@
#include "GEOM_ToolsGUI.hxx" #include "GEOM_ToolsGUI.hxx"
#include "GEOMGUI.h" #include "GEOMGUI.h"
#include "GEOM_Displayer.h"
#include <SALOME_Prs.h>
#include <SALOMEDSClient.hxx> #include <SALOMEDSClient.hxx>
#include <SALOME_ListIO.hxx>
#include <CORBA.h> class GEOM_Displayer;
class SALOME_View;
class SALOME_ListIO;
#include <qptrlist.h> #include <QList>
//================================================================================= //=================================================================================
// class : GEOMToolsGUI // class : GEOMToolsGUI
@ -85,7 +83,7 @@ private:
// Recursive deletion of object with children // Recursive deletion of object with children
void RemoveObjectWithChildren(_PTR(SObject) obj, void RemoveObjectWithChildren(_PTR(SObject) obj,
_PTR(Study) aStudy, _PTR(Study) aStudy,
QPtrList<SALOME_View> views, QList<SALOME_View*> views,
GEOM_Displayer* disp); GEOM_Displayer* disp);
//checks if the object passed as the first argument depends on the second arguments //checks if the object passed as the first argument depends on the second arguments

View File

@ -0,0 +1,44 @@
TEMPLATE = lib
TARGET = GEOMToolsGUI
DESTDIR = ../../lib
MOC_DIR = ../../moc
OBJECTS_DIR = ../../obj/$$TARGET
QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml
VTK_INCLUDES = $$(VTKHOME)/include/vtk
CASROOT = $$(CASROOT)
CAS_CPPFLAGS = $${CASROOT}/inc
PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4
BOOST_CPPFLAGS = $$(BOOSTDIR)/include
KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome
GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome
CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS
GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome
INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMBase ../GEOMClient ../GEOMImpl ../GEOMGUI $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix
LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMBase -lGEOM $${GUI_LDFLAGS} -lVTKViewer -lOCCViewer -lsuit -lSalomeApp
CONFIG -= debug release debug_and_release
CONFIG += qt thread debug dll shared
win32:DEFINES += WIN32
DEFINES += GEOMTOOLSGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG
SOURCES = GEOMToolsGUI.cxx
SOURCES += GEOMToolsGUI_1.cxx
SOURCES += GEOMToolsGUI_TransparencyDlg.cxx
SOURCES += GEOMToolsGUI_NbIsosDlg.cxx
includes.files = $$HEADERS
includes.path = ../../include
INSTALLS += includes

View File

@ -26,15 +26,15 @@
// Module : GEOM // Module : GEOM
// $Header$ // $Header$
#include <PythonConsole_PyConsole.h> #include <PyConsole_Console.h>
#include "GEOMToolsGUI.h" #include "GEOMToolsGUI.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include "GEOMToolsGUI_TransparencyDlg.h" #include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement #include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
#include "GEOM_Actor.h"
#include "GEOMBase.h" #include "GEOMBase.h"
#include "SALOME_ListIO.hxx" #include "SALOME_ListIO.hxx"
@ -45,10 +45,8 @@
#include <SVTK_View.h> #include <SVTK_View.h>
#include <OCCViewer_ViewModel.h> #include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewWindow.h>
#include <SUIT_ViewManager.h> #include <SUIT_ViewManager.h>
#include <SUIT_Application.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h> #include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h> #include <SUIT_Session.h>
@ -62,31 +60,16 @@
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <LightApp_NameDlg.h> #include <LightApp_NameDlg.h>
#include "SALOMEDSClient.hxx"
#include "utilities.h" #include "utilities.h"
// OCCT Includes // OCCT Includes
#include <AIS_Drawer.hxx> #include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
#include <Prs3d_PointAspect.hxx> #include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx> #include <Graphic3d_AspectMarker3d.hxx>
// VTK Includes
#include <vtkBMPReader.h>
#include <vtkTexture.h>
#include <vtkTextureMapToPlane.h>
#include <vtkTransformTextureCoords.h>
#include <vtkDataSetMapper.h>
#include <vtkRenderer.h>
// QT Includes // QT Includes
#include <qfileinfo.h> #include <QColorDialog>
#include <qcolordialog.h>
#include <qspinbox.h>
#include <qapplication.h>
using namespace std; using namespace std;
@ -157,7 +140,9 @@ void GEOMToolsGUI::OnSettingsStep()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100. ); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100. );
Standard_Boolean res = false; Standard_Boolean res = false;
double dd = GEOMBase::Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3); double dd = GEOMBase::Parameter( res, QString("%1").arg(step).toStdString().c_str(),
tr("GEOM_MEN_STEP_LABEL").toStdString().c_str(),
tr("GEOM_STEP_TITLE").toStdString().c_str(), 0.001, 10000.0, 3);
if(res) { if(res) {
resMgr->setValue( "Geometry", "SettingsGeomStep", dd ); resMgr->setValue( "Geometry", "SettingsGeomStep", dd );
@ -182,10 +167,10 @@ void GEOMToolsGUI::OnRename()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warning ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
@ -200,12 +185,12 @@ void GEOMToolsGUI::OnRename()
QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() ); QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) { if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject aName->SetValue( newName.toLatin1().constData() ); // rename the SObject
IObject->setName( newName.latin1() );// rename the InteractiveObject IObject->setName( newName.toLatin1() );// rename the InteractiveObject
// Rename the corresponding GEOM_Object // Rename the corresponding GEOM_Object
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
if (!CORBA::is_nil( anObj )) if (!CORBA::is_nil( anObj ))
anObj->SetName( newName.latin1() ); anObj->SetName( newName.toLatin1() );
(dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false ); (dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
} }
} // if ( name attribute ) } // if ( name attribute )
@ -221,7 +206,7 @@ void GEOMToolsGUI::OnRename()
void GEOMToolsGUI::OnCheckGeometry() void GEOMToolsGUI::OnCheckGeometry()
{ {
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
PythonConsole* pyConsole = app->pythonConsole(); PyConsole_Console* pyConsole = app->pythonConsole();
if(pyConsole) if(pyConsole)
pyConsole->exec("from GEOM_usinggeom import *"); pyConsole->exec("from GEOM_usinggeom import *");

View File

@ -31,14 +31,16 @@
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h> #include <SUIT_Session.h>
#include <SUIT_Tools.h> #include <SUIT_Tools.h>
#include <qlabel.h> #include <QLabel>
#include <qpushbutton.h> #include <QPushButton>
#include <qgroupbox.h> #include <QGroupBox>
#include <qlayout.h> #include <QGridLayout>
#include <qspinbox.h> #include <QSpinBox>
#include <QKeyEvent>
//using namespace std; //using namespace std;
//================================================================================= //=================================================================================
@ -49,55 +51,59 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent ) GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent )
:QDialog( parent, "GEOMToolsGUI_NbIsosDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) :QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
{ {
setCaption( tr( "GEOM_MEN_ISOS" ) ); setObjectName( "GEOMToolsGUI_NbIsosDlg" );
setModal( true );
setWindowTitle( tr( "GEOM_MEN_ISOS" ) );
setSizeGripEnabled(TRUE); setSizeGripEnabled(TRUE);
QGridLayout* MyDialogLayout = new QGridLayout(this); QGridLayout* MyDialogLayout = new QGridLayout(this);
MyDialogLayout->setSpacing(6); MyDialogLayout->setSpacing(6);
MyDialogLayout->setMargin(11); MyDialogLayout->setMargin(11);
/***************************************************************/ /***************************************************************/
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); QGroupBox* GroupC1 = new QGroupBox( this );
GroupC1->setColumnLayout(0, Qt::Vertical ); GroupC1->setObjectName( "GroupC1" );
GroupC1->layout()->setSpacing( 0 ); QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
GroupC1->layout()->setMargin( 0 );
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 ); GroupC1Layout->setMargin( 11 );
QLabel* TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); QLabel* TextLabel1 = new QLabel( GroupC1 );
TextLabel1->setObjectName( "TextLabel1" );
TextLabel1->setText( tr( "GEOM_MEN_ISOU") ); TextLabel1->setText( tr( "GEOM_MEN_ISOU") );
GroupC1Layout->addWidget( TextLabel1, 0, 0 ); GroupC1Layout->addWidget( TextLabel1, 0, 0 );
SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" ); SpinBoxU = new QSpinBox( GroupC1 );
SpinBoxU->setObjectName( "SpinBoxU" );
SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBoxU->setMinValue( 0 ); SpinBoxU->setMinimum( 0 );
SpinBoxU->setValue( 1 ); SpinBoxU->setValue( 1 );
GroupC1Layout->addWidget( SpinBoxU, 0, 1 ); GroupC1Layout->addWidget( SpinBoxU, 0, 1 );
QLabel* TextLabel2 = new QLabel( GroupC1, "TextLabel2" ); QLabel* TextLabel2 = new QLabel( GroupC1 );
TextLabel2->setObjectName( "TextLabel2" );
TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ; TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ;
GroupC1Layout->addWidget( TextLabel2, 0, 2 ); GroupC1Layout->addWidget( TextLabel2, 0, 2 );
SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV"); SpinBoxV = new QSpinBox( GroupC1 );
SpinBoxV->setObjectName( "SpinBoxV");
SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBoxV->setValue( 1 ); SpinBoxV->setValue( 1 );
SpinBoxV->setMinValue( 0 ); SpinBoxV->setMinimum( 0 );
GroupC1Layout->addWidget( SpinBoxV, 0, 3 ); GroupC1Layout->addWidget( SpinBoxV, 0, 3 );
/***************************************************************/ /***************************************************************/
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); QGroupBox* GroupButtons = new QGroupBox( this );
GroupButtons->setColumnLayout(0, Qt::Vertical ); GroupButtons->setObjectName( "GroupButtons" );
GroupButtons->layout()->setSpacing( 0 ); QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons );
GroupButtons->layout()->setMargin( 0 );
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setMargin( 11 );
QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); QPushButton* buttonOk = new QPushButton( GroupButtons );
buttonOk->setObjectName( "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ; buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
buttonOk->setAutoDefault( TRUE ); buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE ); buttonOk->setDefault( TRUE );
@ -105,12 +111,14 @@ GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent )
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
QPushButton* buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); QPushButton* buttonCancel = new QPushButton( GroupButtons );
buttonCancel->setObjectName( "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ; buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
buttonCancel->setAutoDefault( TRUE ); buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 ); GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
QPushButton* buttonHelp = new QPushButton( GroupButtons, "buttonHelp" ); QPushButton* buttonHelp = new QPushButton( GroupButtons );
buttonHelp->setObjectName( "buttonHelp" );
buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ) ; buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ) ;
buttonHelp->setAutoDefault( TRUE ); buttonHelp->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonHelp, 0, 2 ); GroupButtonsLayout->addWidget( buttonHelp, 0, 2 );
@ -177,10 +185,10 @@ void GEOMToolsGUI_NbIsosDlg::ClickOnHelp()
#else #else
platform = "application"; platform = "application";
#endif #endif
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
QObject::tr("BUT_OK")); QObject::tr("BUT_OK"));
} }
} }
@ -194,7 +202,7 @@ void GEOMToolsGUI_NbIsosDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() ) if ( e->isAccepted() )
return; return;
if ( e->key() == Key_F1 ) if ( e->key() == Qt::Key_F1 )
{ {
e->accept(); e->accept();
ClickOnHelp(); ClickOnHelp();

View File

@ -31,7 +31,7 @@
#include "GEOM_ToolsGUI.hxx" #include "GEOM_ToolsGUI.hxx"
#include <qdialog.h> #include <QDialog>
class QSpinBox; class QSpinBox;

View File

@ -39,10 +39,8 @@
#include <SVTK_View.h> #include <SVTK_View.h>
#include <OCCViewer_ViewModel.h> #include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewWindow.h>
#include <SUIT_ViewManager.h> #include <SUIT_ViewManager.h>
#include <SUIT_Application.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h> #include <SUIT_ResourceMgr.h>
@ -53,16 +51,12 @@
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <qframe.h> #include <QLabel>
#include <qlabel.h> #include <QPushButton>
#include <qpushbutton.h> #include <QSlider>
#include <qslider.h> #include <QGridLayout>
#include <qlayout.h> #include <QGroupBox>
#include <qvariant.h> #include <QKeyEvent>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qapplication.h>
#include <qgroupbox.h>
#include <AIS_InteractiveContext.hxx> #include <AIS_InteractiveContext.hxx>
using namespace std; using namespace std;
@ -76,31 +70,34 @@ using namespace std;
// //
//================================================================================= //=================================================================================
GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent )
:QDialog( parent, "GEOMBase_TransparencyDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
{ {
setObjectName( "GEOMBase_TransparencyDlg" );
setModal( true );
resize(152, 107); resize(152, 107);
setCaption(tr("GEOM_TRANSPARENCY_TITLE")); setWindowTitle(tr("GEOM_TRANSPARENCY_TITLE"));
setSizeGripEnabled(TRUE); setSizeGripEnabled(TRUE);
QGridLayout* lay = new QGridLayout(this); QGridLayout* lay = new QGridLayout(this);
lay->setSpacing(6); lay->setSpacing(6);
lay->setMargin(11); lay->setMargin(11);
/*************************************************************************/ /*************************************************************************/
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); QGroupBox* GroupButtons = new QGroupBox( this );
GroupButtons->setColumnLayout(0, Qt::Vertical ); GroupButtons->setObjectName( "GroupButtons" );
GroupButtons->layout()->setSpacing( 0 ); QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons );
GroupButtons->layout()->setMargin( 0 );
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setMargin( 11 );
QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); QPushButton* buttonOk = new QPushButton( GroupButtons );
buttonOk->setObjectName( "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) ); buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE ); buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE ); buttonOk->setDefault( TRUE );
QPushButton* buttonHelp = new QPushButton( GroupButtons, "buttonHelp" ); QPushButton* buttonHelp = new QPushButton( GroupButtons );
buttonHelp->setObjectName( "buttonHelp" );
buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ); buttonHelp->setText( tr( "GEOM_BUT_HELP" ) );
buttonHelp->setAutoDefault( TRUE ); buttonHelp->setAutoDefault( TRUE );
buttonHelp->setDefault( TRUE ); buttonHelp->setDefault( TRUE );
@ -108,32 +105,37 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent )
GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GroupButtonsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 ); GroupButtonsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
GroupButtonsLayout->addWidget( buttonHelp, 0, 2 ); GroupButtonsLayout->addWidget( buttonHelp, 0, 2 );
/*************************************************************************/ /*************************************************************************/
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); QGroupBox* GroupC1 = new QGroupBox( this );
GroupC1->setColumnLayout(0, Qt::Vertical ); GroupC1->setObjectName( "GroupC1" );
GroupC1->layout()->setSpacing( 0 ); QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
GroupC1->layout()->setMargin( 0 );
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 ); GroupC1Layout->setMargin( 11 );
QLabel* TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); QLabel* TextLabelOpaque = new QLabel( GroupC1 );
TextLabelOpaque->setObjectName( "TextLabelOpaque" );
TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) ); TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) );
TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); TextLabelOpaque->setAlignment( Qt::AlignLeft );
GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 );
GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
QLabel* TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); QLabel* TextLabelTransparent = new QLabel( GroupC1 );
TextLabelTransparent->setObjectName( "TextLabelTransparent" );
TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) ); TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) );
TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) ); TextLabelTransparent->setAlignment( Qt::AlignRight );
GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 );
mySlider = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "mySlider" ); mySlider = new QSlider( Qt::Horizontal, GroupC1 );
mySlider->setObjectName( "mySlider" );
mySlider->setMinimum( 0 );
mySlider->setMaximum( 10 );
mySlider->setPageStep( 1 );
mySlider->setValue( 5 );
mySlider->setMinimumSize( 300, 0 ); mySlider->setMinimumSize( 300, 0 );
mySlider->setTickmarks( QSlider::Left ); mySlider->setTickPosition( QSlider::TicksLeft );
GroupC1Layout->addMultiCellWidget( mySlider, 1, 1, 0, 2 ); GroupC1Layout->addWidget( mySlider, 1, 0, 1, 3 );
/*************************************************************************/ /*************************************************************************/
lay->addWidget(GroupC1, 0, 0); lay->addWidget(GroupC1, 0, 0);
@ -204,10 +206,10 @@ void GEOMToolsGUI_TransparencyDlg::ClickOnHelp()
#else #else
platform = "application"; platform = "application";
#endif #endif
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
QObject::tr("BUT_OK")); QObject::tr("BUT_OK"));
} }
} }
@ -296,7 +298,7 @@ void GEOMToolsGUI_TransparencyDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() ) if ( e->isAccepted() )
return; return;
if ( e->key() == Key_F1 ) if ( e->key() == Qt::Key_F1 )
{ {
e->accept(); e->accept();
ClickOnHelp(); ClickOnHelp();

View File

@ -31,7 +31,7 @@
#include "GEOM_ToolsGUI.hxx" #include "GEOM_ToolsGUI.hxx"
#include <qdialog.h> #include <QDialog>
class QSlider; class QSlider;

View File

@ -24,7 +24,7 @@ SUBDIRS += DlgRef
SUBDIRS += GEOMFiltersSelection SUBDIRS += GEOMFiltersSelection
SUBDIRS += GEOMGUI SUBDIRS += GEOMGUI
SUBDIRS += GEOMBase SUBDIRS += GEOMBase
#SUBDIRS += GEOMToolsGUI SUBDIRS += GEOMToolsGUI
#SUBDIRS += DisplayGUI #SUBDIRS += DisplayGUI
#SUBDIRS += BasicGUI #SUBDIRS += BasicGUI
#SUBDIRS += PrimitiveGUI #SUBDIRS += PrimitiveGUI