From ce0079c0882a9e5d809e9374be546c005e129aa9 Mon Sep 17 00:00:00 2001 From: mkr Date: Thu, 5 Jul 2007 12:15:04 +0000 Subject: [PATCH] Porting to Qt4. --- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 118 +++++++++--------- src/GEOMToolsGUI/GEOMToolsGUI.h | 12 +- src/GEOMToolsGUI/GEOMToolsGUI.pro | 44 +++++++ src/GEOMToolsGUI/GEOMToolsGUI_1.cxx | 43 +++---- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx | 70 ++++++----- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h | 2 +- .../GEOMToolsGUI_TransparencyDlg.cxx | 84 +++++++------ .../GEOMToolsGUI_TransparencyDlg.h | 2 +- src/src.pro | 2 +- 9 files changed, 207 insertions(+), 170 deletions(-) create mode 100644 src/GEOMToolsGUI/GEOMToolsGUI.pro diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 4a3e34a71..6a14b9571 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -29,33 +29,32 @@ #include "GEOMToolsGUI.h" #include "GeometryGUI.h" -#include "GEOM_Actor.h" #include "GEOMBase.h" #include "GEOM_Operation.h" #include "GEOM_Displayer.h" #include -#include +//#include #include #include #include #include #include #include +#include #include #include #include #include +#include #include #include -#include "utilities.h" - // QT Includes -#include -#include +#include +#include // OCCT Includes #include @@ -83,13 +82,13 @@ static QString getFileName( QWidget* parent, SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true ); if ( !caption.isEmpty() ) - fd->setCaption( caption ); + fd->setWindowTitle( caption ); if ( !initial.isEmpty() ) - fd->setSelection( initial ); + fd->selectFile( initial ); if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) - fd->setSelectedFilter( lastUsedFilter ); + fd->selectFilter( lastUsedFilter ); fd->setFilters( filters ); @@ -280,10 +279,10 @@ void GEOMToolsGUI::OnEditDelete() bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - SUIT_MessageBox::warn1 ( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return; } @@ -294,31 +293,32 @@ void GEOMToolsGUI::OnEditDelete() QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) ); if ( parentComp != geomComp ) { - SUIT_MessageBox::warn1 ( app->desktop(), - QObject::tr("ERR_ERROR"), - QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( app->desktop(), + QObject::tr("ERR_ERROR"), + QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ), + QObject::tr("BUT_OK") ); return; } // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish - if ( SUIT_MessageBox::warn2( app->desktop(), - QObject::tr( "GEOM_WRN_WARNING" ), - QObject::tr( "GEOM_REALLY_DELETE" ), - QObject::tr( "GEOM_BUT_YES" ), - QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 ) + if ( SUIT_MessageBox::warning( app->desktop(), + QObject::tr( "GEOM_WRN_WARNING" ), + QObject::tr( "GEOM_REALLY_DELETE" ), + QObject::tr( "GEOM_BUT_YES" ), + QObject::tr( "GEOM_BUT_NO" ), 1 ) != 0 ) return; // QAD_Operation* op = new SALOMEGUI_ImportOperation(.....); // op->start(); // prepare list of SALOME_Views - QPtrList views; + QList views; SALOME_View* view; // fill the list ViewManagerList vmans = app->viewManagers(); SUIT_ViewManager* vman; - for ( vman = vmans.first(); vman; vman = vmans.next() ) { + QListIterator it( vmans ); + while ( it.hasNext() && (vman = it.next()) ) { SUIT_ViewModel* vmod = vman->getViewModel(); view = dynamic_cast ( vmod ); // must work for OCC and VTK views if ( view ) @@ -439,19 +439,19 @@ bool GEOMToolsGUI::Import() bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - SUIT_MessageBox::warn1 ( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); if ( CORBA::is_nil( eng ) ) { - SUIT_MessageBox::error1( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr( "GEOM Engine is not started" ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::critical( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ), + QObject::tr("BUT_OK") ); return false; } @@ -478,7 +478,7 @@ bool GEOMToolsGUI::Import() { // Trying to detect file type QFileInfo aFileInfo( fileName ); - QString aPossibleType = (aFileInfo.extension(false)).upper() ; + QString aPossibleType = (aFileInfo.suffix()).toUpper() ; if ( (aMap.values()).contains(aPossibleType) ) fileType = aPossibleType; @@ -495,8 +495,8 @@ bool GEOMToolsGUI::Import() anOp->start(); - CORBA::String_var fileN = fileName.latin1(); - CORBA::String_var fileT = fileType.latin1(); + CORBA::String_var fileN = fileName.toLatin1().data(); + CORBA::String_var fileT = fileType.toLatin1().data(); anObj = aInsOp->Import(fileN, fileT); if ( !anObj->_is_nil() && aInsOp->IsDone() ) { @@ -507,7 +507,7 @@ bool GEOMToolsGUI::Import() GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy, SALOMEDS::SObject::_nil(), anObj, - aPublishObjName); + aPublishObjName.toStdString().c_str()); GEOM_Displayer( stud ).Display( anObj.in() ); @@ -519,10 +519,10 @@ bool GEOMToolsGUI::Import() else { anOp->abort(); wc.suspend(); - SUIT_MessageBox::error1( app->desktop(), - QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::critical( app->desktop(), + QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), + QObject::tr("BUT_OK") ); } } catch( const SALOME::SALOME_Exception& S_ex ) { @@ -555,10 +555,10 @@ bool GEOMToolsGUI::Export() GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); if ( CORBA::is_nil( eng ) ) { - SUIT_MessageBox::error1( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr( "GEOM Engine is not started" ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::critical( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ), + QObject::tr("BUT_OK") ); return false; } @@ -607,7 +607,7 @@ bool GEOMToolsGUI::Export() anOp->start(); - aInsOp->Export( anObj, file, fileType.latin1() ); + aInsOp->Export( anObj, file.toStdString().c_str(), fileType.toLatin1().constData() ); if ( aInsOp->IsDone() ) anOp->commit(); @@ -615,10 +615,10 @@ bool GEOMToolsGUI::Export() { anOp->abort(); wc.suspend(); - SUIT_MessageBox::error1( app->desktop(), - QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::critical( app->desktop(), + QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), + QObject::tr("BUT_OK") ); return false; } } @@ -677,7 +677,7 @@ QString GEOMToolsGUI::getParentComponent( _PTR( SObject ) obj ) //===================================================================================== void GEOMToolsGUI::RemoveObjectWithChildren(_PTR(SObject) obj, _PTR(Study) aStudy, - QPtrList views, + QList views, GEOM_Displayer* disp) { // 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 ); if (!CORBA::is_nil(geomObj)) { // Erase graphical object - SALOME_View* view = views.first(); - for (; view; view = views.next()) { - disp->Erase(geomObj, true, view); - } - + QListIterator it( views ); + while ( it.hasNext() ) + if ( SALOME_View* view = it.next() ) + disp->Erase(geomObj, true, view); + // Remove object from Engine GeometryGUI::GetGeomGen()->RemoveObject( geomObj ); } @@ -732,10 +732,10 @@ bool GEOMToolsGUI::CheckSubObjectInUse(_PTR(SObject) checkobj, SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SUIT_MessageBox::warn1 ( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("DEP_OBJECT"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("DEP_OBJECT"), + QObject::tr("BUT_OK") ); return true; } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 07dec456e..d8f583a64 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -32,16 +32,14 @@ #include "GEOM_ToolsGUI.hxx" #include "GEOMGUI.h" -#include "GEOM_Displayer.h" - -#include #include -#include -#include +class GEOM_Displayer; +class SALOME_View; +class SALOME_ListIO; -#include +#include //================================================================================= // class : GEOMToolsGUI @@ -85,7 +83,7 @@ private: // Recursive deletion of object with children void RemoveObjectWithChildren(_PTR(SObject) obj, _PTR(Study) aStudy, - QPtrList views, + QList views, GEOM_Displayer* disp); //checks if the object passed as the first argument depends on the second arguments diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.pro b/src/GEOMToolsGUI/GEOMToolsGUI.pro new file mode 100644 index 000000000..f2728cb89 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.pro @@ -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 diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 2becab38d..466c34682 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -26,15 +26,15 @@ // Module : GEOM // $Header$ -#include +#include #include "GEOMToolsGUI.h" #include "GeometryGUI.h" +#include "GEOM_Displayer.h" #include "GEOMToolsGUI_TransparencyDlg.h" #include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement -#include "GEOM_Actor.h" #include "GEOMBase.h" #include "SALOME_ListIO.hxx" @@ -45,10 +45,8 @@ #include #include -#include #include -#include #include #include #include @@ -62,31 +60,16 @@ #include #include -#include "SALOMEDSClient.hxx" - #include "utilities.h" // OCCT Includes #include -#include -#include #include #include #include -// VTK Includes -#include -#include -#include -#include -#include -#include - // QT Includes -#include -#include -#include -#include +#include using namespace std; @@ -157,7 +140,9 @@ void GEOMToolsGUI::OnSettingsStep() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100. ); 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) { resMgr->setValue( "Geometry", "SettingsGeomStep", dd ); @@ -182,10 +167,10 @@ void GEOMToolsGUI::OnRename() bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - SUIT_MessageBox::warn1 ( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return; } @@ -200,12 +185,12 @@ void GEOMToolsGUI::OnRename() QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() ); if ( !newName.isEmpty() ) { - aName->SetValue( newName.latin1() ); // rename the SObject - IObject->setName( newName.latin1() );// rename the InteractiveObject + aName->SetValue( newName.toLatin1().constData() ); // rename the SObject + IObject->setName( newName.toLatin1() );// rename the InteractiveObject // Rename the corresponding GEOM_Object GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); if (!CORBA::is_nil( anObj )) - anObj->SetName( newName.latin1() ); + anObj->SetName( newName.toLatin1() ); (dynamic_cast(app->activeModule()))->updateObjBrowser( false ); } } // if ( name attribute ) @@ -221,7 +206,7 @@ void GEOMToolsGUI::OnRename() void GEOMToolsGUI::OnCheckGeometry() { SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - PythonConsole* pyConsole = app->pythonConsole(); + PyConsole_Console* pyConsole = app->pythonConsole(); if(pyConsole) pyConsole->exec("from GEOM_usinggeom import *"); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index 05c9d39ab..da30e07dc 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -31,14 +31,16 @@ #include "GeometryGUI.h" #include #include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include //using namespace std; //================================================================================= @@ -49,55 +51,59 @@ // TRUE to construct a modal dialog. //================================================================================= 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); QGridLayout* MyDialogLayout = new QGridLayout(this); MyDialogLayout->setSpacing(6); MyDialogLayout->setMargin(11); /***************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + QGroupBox* GroupC1 = new QGroupBox( this ); + GroupC1->setObjectName( "GroupC1" ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 ); GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setMargin( 11 ); - QLabel* TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); + QLabel* TextLabel1 = new QLabel( GroupC1 ); + TextLabel1->setObjectName( "TextLabel1" ); TextLabel1->setText( tr( "GEOM_MEN_ISOU") ); 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->setMinValue( 0 ); + SpinBoxU->setMinimum( 0 ); SpinBoxU->setValue( 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") ) ; 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->setValue( 1 ); - SpinBoxV->setMinValue( 0 ); + SpinBoxV->setMinimum( 0 ); GroupC1Layout->addWidget( SpinBoxV, 0, 3 ); /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + QGroupBox* GroupButtons = new QGroupBox( this ); + GroupButtons->setObjectName( "GroupButtons" ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons ); GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setMargin( 11 ); - QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + QPushButton* buttonOk = new QPushButton( GroupButtons ); + buttonOk->setObjectName( "buttonOk" ); buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ; buttonOk->setAutoDefault( 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 ); - QPushButton* buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + QPushButton* buttonCancel = new QPushButton( GroupButtons ); + buttonCancel->setObjectName( "buttonCancel" ); buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ; buttonCancel->setAutoDefault( TRUE ); 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->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonHelp, 0, 2 ); @@ -177,10 +185,10 @@ void GEOMToolsGUI_NbIsosDlg::ClickOnHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); } } @@ -194,7 +202,7 @@ void GEOMToolsGUI_NbIsosDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) + if ( e->key() == Qt::Key_F1 ) { e->accept(); ClickOnHelp(); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h index e93b1ded3..68bf75a7b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -31,7 +31,7 @@ #include "GEOM_ToolsGUI.hxx" -#include +#include class QSpinBox; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index 7e7151a6c..b4eae74df 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -39,10 +39,8 @@ #include #include -#include #include -#include #include #include #include @@ -53,16 +51,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include using namespace std; @@ -76,31 +70,34 @@ using namespace std; // //================================================================================= 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); - setCaption(tr("GEOM_TRANSPARENCY_TITLE")); + setWindowTitle(tr("GEOM_TRANSPARENCY_TITLE")); setSizeGripEnabled(TRUE); QGridLayout* lay = new QGridLayout(this); lay->setSpacing(6); lay->setMargin(11); - + /*************************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + QGroupBox* GroupButtons = new QGroupBox( this ); + GroupButtons->setObjectName( "GroupButtons" ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons ); GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setMargin( 11 ); - QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + QPushButton* buttonOk = new QPushButton( GroupButtons ); + buttonOk->setObjectName( "buttonOk" ); buttonOk->setText( tr( "GEOM_BUT_OK" ) ); buttonOk->setAutoDefault( 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->setAutoDefault( TRUE ); buttonHelp->setDefault( TRUE ); @@ -108,32 +105,37 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); GroupButtonsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 ); GroupButtonsLayout->addWidget( buttonHelp, 0, 2 ); - + /*************************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + QGroupBox* GroupC1 = new QGroupBox( this ); + GroupC1->setObjectName( "GroupC1" ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 ); GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setMargin( 11 ); - QLabel* TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); + QLabel* TextLabelOpaque = new QLabel( GroupC1 ); + TextLabelOpaque->setObjectName( "TextLabelOpaque" ); TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) ); - TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); + TextLabelOpaque->setAlignment( Qt::AlignLeft ); GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); 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->setAlignment( int( QLabel::AlignRight ) ); + TextLabelTransparent->setAlignment( Qt::AlignRight ); 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->setTickmarks( QSlider::Left ); - GroupC1Layout->addMultiCellWidget( mySlider, 1, 1, 0, 2 ); + mySlider->setTickPosition( QSlider::TicksLeft ); + GroupC1Layout->addWidget( mySlider, 1, 0, 1, 3 ); /*************************************************************************/ lay->addWidget(GroupC1, 0, 0); @@ -204,10 +206,10 @@ void GEOMToolsGUI_TransparencyDlg::ClickOnHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); } } @@ -296,7 +298,7 @@ void GEOMToolsGUI_TransparencyDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) + if ( e->key() == Qt::Key_F1 ) { e->accept(); ClickOnHelp(); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index 0b7aa869c..03e183088 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -31,7 +31,7 @@ #include "GEOM_ToolsGUI.hxx" -#include +#include class QSlider; diff --git a/src/src.pro b/src/src.pro index 56f213c16..547f7e3bc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -24,7 +24,7 @@ SUBDIRS += DlgRef SUBDIRS += GEOMFiltersSelection SUBDIRS += GEOMGUI SUBDIRS += GEOMBase -#SUBDIRS += GEOMToolsGUI +SUBDIRS += GEOMToolsGUI #SUBDIRS += DisplayGUI #SUBDIRS += BasicGUI #SUBDIRS += PrimitiveGUI -- 2.39.2