From: vsr Date: Thu, 3 Dec 2015 07:41:06 +0000 (+0300) Subject: Minor changes X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de961924ff6dd6e0cdabc0377b7e8abff7d728e2;p=modules%2Fgui.git Minor changes --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d59f610a6..546284a25 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,7 @@ ENDIF() IF(NOT SALOME_BUILD_WITH_QT5) FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork) INCLUDE(${QT_USE_FILE}) + ADD_DEFINITIONS("-DUSE_SALOME_STYLE") ELSE() FIND_PACKAGE(SalomeQt5 REQUIRED) ENDIF() diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index 1d4e95d8a..d8bd48cd3 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -442,6 +442,7 @@ static GLuint displayListBase( QFont* theFont ) int aFontCont = 0; QString aFontDef = theFont->toString(); char** xFontList = XListFonts( aDisp, aFontDef.toLatin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont ); +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if( !theFont->handle() ) { diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index 955288cf6..cf55d26cd 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -122,14 +122,16 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) cout << "Choosing cmap for vID = " << vi->visualid << endl; #endif - /* if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { #ifdef DEBUG cout << "Using x11AppColormap" << endl; #endif return QX11Info::appColormap(); - } */ - + } +#endif if ( mesa_gl ) { Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true ); diff --git a/src/GraphicsView/GraphicsView_Object.cxx b/src/GraphicsView/GraphicsView_Object.cxx index 13364db28..a3d1b87a3 100644 --- a/src/GraphicsView/GraphicsView_Object.cxx +++ b/src/GraphicsView/GraphicsView_Object.cxx @@ -51,7 +51,7 @@ GraphicsView_Object::~GraphicsView_Object() removeFromGroup( aChild ); if( QGraphicsScene* aScene = aChild->scene() ) aScene->removeItem( aChild ); - delete ( aChild ); + delete aChild; aChild = 0; } } diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 00030bb0d..b4e80d606 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -62,8 +62,10 @@ #include +#ifdef USE_SALOME_STYLE #include #include +#endif // USE_SALOME_STYLE #include #include @@ -776,8 +778,10 @@ void LightApp_Application::createActions() createMenu( MRUId, fileMenu, 100, -1 ); createMenu( separator(), fileMenu, -1, 100, -1 ); +#ifdef USE_SALOME_STYLE createAction( StyleId, tr( "TOT_THEME" ), QIcon(), tr( "MEN_DESK_THEME" ), tr( "PRP_THEME" ), 0, desk, false, this, SLOT( onStylePreferences() ) ); +#endif // USE_SALOME_STYLE createAction( FullScreenId, tr( "TOT_FULLSCREEN" ), QIcon(), tr( "MEN_DESK_FULLSCREEN" ), tr( "PRP_FULLSCREEN" ), Qt::Key_F11, desk, false, this, SLOT( onFullScreen() ) ); @@ -785,7 +789,9 @@ void LightApp_Application::createActions() int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 ); createMenu( separator(), viewMenu, -1, 20, -1 ); +#ifdef USE_SALOME_STYLE createMenu( StyleId, viewMenu, 20, -1 ); +#endif // USE_SALOME_STYLE createMenu( FullScreenId, viewMenu, 20, -1 ); int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ), // title (language-dependant) @@ -4248,10 +4254,12 @@ void LightApp_Application::onMRUActivated( const QString& name ) void LightApp_Application::onStylePreferences() { +#ifdef USE_SALOME_STYLE Style_PrefDlg dlg( desktop() ); dlg.exec(); resourceMgr()->setValue( "Style", "use_salome_style", Style_Salome::isActive() ); +#endif // USE_SALOME_STYLE } void LightApp_Application::onFullScreen(){ diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx index b4d7b0431..f14c8265a 100755 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -114,6 +114,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) //#ifdef DEBUG //cout << "Choosing cmap for vID = " << vi->visualid << endl; //#endif +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { diff --git a/src/Qtx/QtxWorkspaceAction.cxx b/src/Qtx/QtxWorkspaceAction.cxx index d4b037048..1818a6d68 100644 --- a/src/Qtx/QtxWorkspaceAction.cxx +++ b/src/Qtx/QtxWorkspaceAction.cxx @@ -311,11 +311,11 @@ void QtxWorkspaceAction::removedFrom( QWidget* w ) */ void QtxWorkspaceAction::updateContent() { - bool count = workspace() ? workspace()->subWindowList().count() : 0; - action( Cascade )->setEnabled( count ); - action( Tile )->setEnabled( count ); - action( HTile )->setEnabled( count ); - action( VTile )->setEnabled( count ); + bool hasWindows = workspace() && workspace()->subWindowList().count() > 0; + action( Cascade )->setEnabled( hasWindows ); + action( Tile )->setEnabled( hasWindows ); + action( HTile )->setEnabled( hasWindows ); + action( VTile )->setEnabled( hasWindows ); updateWindows(); } diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 9a8fac27d..aaf031548 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -46,7 +46,9 @@ #include "SUIT_LicenseDlg.h" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" +#ifdef USE_SALOME_STYLE #include "Style_Salome.h" +#endif // USE_SALOME_STYLE #include "QtxSplash.h" #include @@ -184,10 +186,11 @@ int main( int argc, char* argv[] ) if ( !qtdir.isEmpty() ) QApplication::addLibraryPath( QDir( qtdir ).absoluteFilePath( "plugins" ) ); +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) //Set a "native" graphic system in case if application runs on the remote host QString remote(::getenv("REMOTEHOST")); QString client(::getenv("SSH_CLIENT")); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if(remote.length() > 0 || client.length() > 0 ) { QApplication::setGraphicsSystem(QLatin1String("native")); } @@ -276,9 +279,11 @@ int main( int argc, char* argv[] ) SUIT_Application* theApp = aSession.startApplication( argList.first() ); if ( theApp ) { +#ifdef USE_SALOME_STYLE Style_Salome::initialize( theApp->resourceMgr() ); if ( theApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) ) Style_Salome::apply(); +#endif // USE_SALOME_STYLE if ( !noExceptHandling ) app.setHandler( aSession.handler() ); diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 592328fcd..7864c19d5 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -43,6 +43,7 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_Exception #ifdef ENABLE_TESTRECORDER : TestApplication( argc, argv ), #else +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if !defined(WIN32) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) // san: Opening an X display and choosing a visual most suitable for 3D visualization // in order to make SALOME viewers work with non-native X servers @@ -58,6 +59,7 @@ myExceptHandler( hand ) /*! Constructor */ +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand ) #ifdef ENABLE_TESTRECORDER diff --git a/src/SUITApp/SUITApp_Application.h b/src/SUITApp/SUITApp_Application.h index 2db4b8169..ec2f94330 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -51,6 +51,7 @@ class SUIT_ExceptionHandler; public: SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* = 0 ); +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 ); #endif diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index a8f5428cf..ab1b2ed06 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -439,6 +439,7 @@ QVTK_RenderWindowInteractor #endif } +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifdef WIN32 diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index 0aded2b66..27a4daba9 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -122,6 +122,7 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget virtual void focusOutEvent( QFocusEvent* ); //! To handle native events (from such devices as SpaceMouse) +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifdef WIN32 virtual bool winEvent( MSG*, long* ); diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 89560ca9a..b8fe3bf54 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -52,7 +52,9 @@ #include #include +#ifdef USE_SALOME_STYLE #include +#endif // USE_SALOME_STYLE #include "GUI_version.h" #include @@ -254,6 +256,7 @@ public: SALOME_QApplication( int& argc, char** argv ) : TestApplication( argc, argv ), myHandler ( 0 ) {} #else SALOME_QApplication( int& argc, char** argv ) +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if !defined WIN32 && QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // san: Opening an X display and choosing a visual most suitable for 3D visualization // in order to make SALOME viewers work with non-native X servers @@ -350,6 +353,7 @@ int main( int argc, char **argv ) qInstallMessageHandler( MessageOutput ); #endif +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) //Set a "native" graphic system in case if application runs on the remote host QString remote(getenv("REMOTEHOST")); @@ -575,9 +579,11 @@ int main( int argc, char **argv ) SUIT_Application* aGUIApp = aGUISession->startApplication( "SalomeApp", 0, 0 ); if ( aGUIApp ) { +#ifdef USE_SALOME_STYLE Style_Salome::initialize( aGUIApp->resourceMgr() ); if ( aGUIApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) ) Style_Salome::apply(); +#endif // USE_SALOME_STYLE if ( !isFound( "noexcepthandler", argc, argv ) ) _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index 56d8c5de8..bf355581a 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -1721,7 +1721,10 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, p->setPen(opt->palette.text().color()); } // Fall through! case PE_IndicatorViewItemCheck: - /* case PE_Q3CheckListIndicator: { +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + case PE_Q3CheckListIndicator: +#endif + { if (!doRestore) { p->save(); doRestore = true; @@ -1762,7 +1765,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, if (doRestore) p->restore(); break; - }*/ + } case PE_IndicatorRadioButton: { if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) ) drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ),