From: rnv Date: Thu, 30 May 2019 11:59:57 +0000 (+0300) Subject: Remove QT4 compatibility. X-Git-Tag: V9_4_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=944a88161c28aa3414d534728169b4f21f68de47;p=modules%2Fgui.git Remove QT4 compatibility. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 874bd0835..c70185f65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,6 @@ SET(BUILD_SHARED_LIBS TRUE) OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON) OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) OPTION(SALOME_GUI_USE_OBSERVERS "Use study observers in GUI (advanced)" ON) -OPTION(SALOME_BUILD_WITH_QT5 "Build SALOME with Qt 5" ON) CMAKE_DEPENDENT_OPTION(SALOME_GUI_BUILD_FRENCH_DOC "Generate SALOME GUI French documentation" OFF "SALOME_BUILD_DOC" OFF) @@ -160,31 +159,20 @@ IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) ENDIF() # Qt -IF(NOT SALOME_BUILD_WITH_QT5) - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork) - ADD_DEFINITIONS("-DUSE_SALOME_STYLE") - SET(QT_SALOME_VERSION 4) - SET(SALOME_GUI_ENABLE_QTXWEBBROWSER TRUE) -ELSE() - FIND_PACKAGE(SalomeQt5 REQUIRED) - SET(QT_SALOME_VERSION 5) - SET(SALOME_GUI_ENABLE_QTXWEBBROWSER TRUE) - IF(NOT "${QT_VERSION}" VERSION_LESS "5.6.0") - # Check that WebEngineWidgets component was found - IF(NOT Qt5WebEngineWidgets_FOUND) - SET(SALOME_GUI_ENABLE_QTXWEBBROWSER FALSE) - ADD_DEFINITIONS("-DDISABLE_QTXWEBBROWSER") - MESSAGE("Qt5WebEngineWidgets is not found, SALOME internal help browser will be unavailable !") - ENDIF() +FIND_PACKAGE(SalomeQt5 REQUIRED) +SET(QT_SALOME_VERSION 5) +SET(SALOME_GUI_ENABLE_QTXWEBBROWSER TRUE) +IF(NOT "${QT_VERSION}" VERSION_LESS "5.6.0") + # Check that WebEngineWidgets component was found + IF(NOT Qt5WebEngineWidgets_FOUND) + SET(SALOME_GUI_ENABLE_QTXWEBBROWSER FALSE) + ADD_DEFINITIONS("-DDISABLE_QTXWEBBROWSER") + MESSAGE("Qt5WebEngineWidgets is not found, SALOME internal help browser will be unavailable !") ENDIF() ENDIF() # PyQt -IF (NOT SALOME_BUILD_WITH_QT5) - FIND_PACKAGE(SalomePyQt4 REQUIRED) -ELSE() - FIND_PACKAGE(SalomePyQt5 REQUIRED) -ENDIF() +FIND_PACKAGE(SalomePyQt5 REQUIRED) # Optional packages for GUI and their pre-requisites @@ -439,13 +427,9 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} # Ensure the variables are always defined for the configure: SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}") SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}") -IF(NOT SALOME_BUILD_WITH_QT5) - SET(QT_ROOT_DIR "${QT4_ROOT_DIR}") - SET(PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}") -ELSE() - SET(QT_ROOT_DIR "${QT5_ROOT_DIR}") - SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}") -ENDIF() +SET(QT_ROOT_DIR "${QT5_ROOT_DIR}") +SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}") + SET(OPENCASCADE_ROOT_DIR "${OPENCASCADE_ROOT_DIR}") SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}") SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}") @@ -454,11 +438,7 @@ SET(QWT_ROOT_DIR "${QWT_ROOT_DIR}") SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") # Build variables that will be expanded when configuring SalomeConfig.cmake: -IF(NOT SALOME_BUILD_WITH_QT5) - SALOME_CONFIGURE_PREPARE(OpenCASCADE OpenGL Qt4 PyQt4 Qwt SIP VTK) -ELSE() - SALOME_CONFIGURE_PREPARE(OpenCASCADE OpenGL Qt5 PyQt5 Qwt SIP VTK) -ENDIF() +SALOME_CONFIGURE_PREPARE(OpenCASCADE OpenGL Qt5 PyQt5 Qwt SIP VTK) CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index a47667865..08492ef2f 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -50,7 +50,6 @@ SET(GUI_DEFINITIONS "@KERNEL_DEFINITIONS@") SET(SALOME_GUI_BUILD_DOC @SALOME_BUILD_DOC@) SET(SALOME_GUI_BUILD_TESTS @SALOME_BUILD_TESTS@) SET(SALOME_GUI_LIGHT_ONLY @SALOME_LIGHT_ONLY@) -SET(SALOME_GUI_BUILD_WITH_QT5 @SALOME_BUILD_WITH_QT5@) # Advanced options SET(SALOME_USE_OCCVIEWER @SALOME_USE_OCCVIEWER@) @@ -111,13 +110,8 @@ ENDIF() # Level 1 prerequisites: SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@") SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@") -IF(NOT SALOME_GUI_BUILD_WITH_QT5) - SET_AND_CHECK(QT4_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@") - SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@") -ELSE() - SET_AND_CHECK(QT5_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@") - SET_AND_CHECK(PYQT5_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@") -ENDIF() +SET_AND_CHECK(QT5_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@") +SET_AND_CHECK(PYQT5_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@") SET_AND_CHECK(OPENCASCADE_ROOT_DIR_EXP "@PACKAGE_OPENCASCADE_ROOT_DIR@") # Optional level 1 prerequisites: diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index 329b0a666..235157558 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -400,9 +400,6 @@ static GLuint displayListBase( QFont* theFont ) listBase += 256; HDC glHdc = ::wglGetCurrentDC(); - #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - ::SelectObject( glHdc, theFont->handle() ); - #endif if ( !::wglUseFontBitmaps( glHdc, 0, 256, listBase ) ) listBase = 0; aList = listBase; @@ -474,33 +471,24 @@ static GLuint displayListBase( QFont* theFont ) 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() ) - { -#endif #ifdef _DEBUG_ - printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ ); + printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ ); #endif - QString aFontMask ("-*-*-*-r-*-*-"); - aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); + QString aFontMask ("-*-*-*-r-*-*-"); + aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); #ifdef _DEBUG_ - printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); + printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); #endif - aFontMask += "-*-*-*-m-*-*-*"; - xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); - if( aFontCont == 0 ) - { + aFontMask += "-*-*-*-m-*-*-*"; + xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); + if( aFontCont == 0 ) + { #ifdef _DEBUG_ - printf( "Can't load default font\n" ); + printf( "Can't load default font\n" ); #endif - return 0; - } - glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + return 0; } - else - glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase ); -#endif + glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase ); aList = listBase; GLViewer_TexFont::BitmapFontCache[aFindFont] = aList; } diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index 562924765..4f1ca1fdc 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -121,16 +121,6 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) #ifdef DEBUG cout << "Choosing cmap for vID = " << vi->visualid << endl; #endif - -#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(); - } -#else if ( vi->visualid == XVisualIDFromVisual( XDefaultVisual( QX11Info::display(), -1 ) ) ) { #ifdef DEBUG @@ -138,7 +128,6 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) #endif return XDefaultColormap( QX11Info::display(), -1 ); } -#endif if ( mesa_gl ) { Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true ); diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx index 1bb4b8751..dab34eb0e 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -888,9 +888,6 @@ void GLViewer_ViewSketcher::onSketch( SketchState state ) if ( state == Fin ) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); /* force rectangle redrawing */ -#endif myViewer->activateSketching( GLViewer_Viewer::NoSketching ); } } diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index fb156593c..4607f6906 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -480,11 +480,7 @@ bool GraphicsView_ViewPort::dumpViewToFormat(const QString& fileName, const QStr return false; QPrinter printer(QPrinter::ScreenResolution); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - printer.setOutputFormat(QPrinter::PostScriptFormat); -#else printer.setOutputFormat(QPrinter::PdfFormat); -#endif printer.setOutputFileName(fileName); QPainter painter; if (!painter.begin(&printer)) diff --git a/src/HelpBrowser/qtlocalpeer.cpp b/src/HelpBrowser/qtlocalpeer.cpp index 19914f458..b96dc676f 100644 --- a/src/HelpBrowser/qtlocalpeer.cpp +++ b/src/HelpBrowser/qtlocalpeer.cpp @@ -119,13 +119,6 @@ bool QtLocalPeer::isClient() return true; bool res = server->listen(socketName); -#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) - // ### Workaround - if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { - QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName); - res = server->listen(socketName); - } -#endif if (!res) qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); diff --git a/src/HelpBrowser/qtlockedfile_win.cpp b/src/HelpBrowser/qtlockedfile_win.cpp index a86bf3d51..1d11492b2 100644 --- a/src/HelpBrowser/qtlockedfile_win.cpp +++ b/src/HelpBrowser/qtlockedfile_win.cpp @@ -46,9 +46,7 @@ // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS #define MAX_READERS MAXIMUM_WAIT_OBJECTS -#if QT_VERSION >= 0x050000 #define QT_WA(unicode, ansi) unicode -#endif Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) { diff --git a/src/HelpBrowser/qtsingleapplication.cpp b/src/HelpBrowser/qtsingleapplication.cpp index d0fb15d76..86adc1129 100644 --- a/src/HelpBrowser/qtsingleapplication.cpp +++ b/src/HelpBrowser/qtsingleapplication.cpp @@ -170,62 +170,6 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char * sysInit(appId); } -#if QT_VERSION < 0x050000 - -/*! - Creates a QtSingleApplication object. The application identifier - will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a type are passed on to the QAppliation constructor. -*/ -QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type) - : QApplication(argc, argv, type) -{ - sysInit(); -} - - -# if defined(Q_WS_X11) -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, - and \a cmap are passed on to the QApplication constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, visual, cmap) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be \a appId. \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) -{ - sysInit(appId); -} -# endif // Q_WS_X11 -#endif // QT_VERSION < 0x050000 - - /*! Returns true if another instance of this application is running; otherwise false. diff --git a/src/HelpBrowser/qtsingleapplication.h b/src/HelpBrowser/qtsingleapplication.h index 049406f72..cb2bfaf73 100644 --- a/src/HelpBrowser/qtsingleapplication.h +++ b/src/HelpBrowser/qtsingleapplication.h @@ -68,14 +68,11 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication public: QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char **argv); -#if QT_VERSION < 0x050000 - QtSingleApplication(int &argc, char **argv, Type type); # if defined(Q_WS_X11) QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); # endif // Q_WS_X11 -#endif // QT_VERSION < 0x050000 bool isRunning(); QString id() const; diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index de5d7a161..83909627c 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -2104,11 +2104,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) // Create OBSelector new LightApp_OBSelector( ob, mySelMgr ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - ob->treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed); -#else ob->treeView()->header()->setSectionResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed); -#endif ob->treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId); ob->treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH); ob->setProperty( "shortcut", QKeySequence( "Alt+Shift+O" ) ); diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx index 39cb380cb..1e5584566 100644 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -115,15 +115,6 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) //cout << "Choosing cmap for vID = " << vi->visualid << endl; //#endif -#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(); - } -#else if ( vi->visualid == XVisualIDFromVisual( XDefaultVisual( QX11Info::display(), -1 ) ) ) { #ifdef DEBUG @@ -131,7 +122,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) #endif return XDefaultColormap( QX11Info::display(), -1 ); } -#endif + if ( mesa_gl ) { Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true ); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index e4e371634..3c1c3a8dd 100644 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -547,9 +547,6 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) mapView( activeView() ); #endif if ( !myWindow.IsNull() ) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); -#endif if ( !myPaintersRedrawing ) { activeView()->Redraw(); } @@ -563,13 +560,10 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) */ void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e ) { -#if defined WIN32 || QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined WIN32 /* Win32 : map before first show to avoid flicker */ if ( !mapped( activeView() ) ) mapView( activeView() ); -#endif -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); #endif QTimer::singleShot( 0, this, SLOT( repaintViewAfterMove() ) ); emit vpResizeEvent( e ); diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.cxx b/src/OCCViewer/OCCViewer_ViewSketcher.cxx index add2206f1..e70aa8c2b 100644 --- a/src/OCCViewer/OCCViewer_ViewSketcher.cxx +++ b/src/OCCViewer/OCCViewer_ViewSketcher.cxx @@ -298,9 +298,6 @@ void OCCViewer_RectSketcher::onSketch( SketchState state ) if ( state == Fin ) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); /* force rectangle redrawing */ -#endif mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); } } @@ -496,9 +493,6 @@ void OCCViewer_PolygonSketcher::onSketch( SketchState state ) if ( state == Fin ) { mypPolyRB->clearGeometry(); mypPolyRB->hide(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); -#endif mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); } else { mypPolyRB->setUpdatesEnabled ( false ); diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index b2ca7284b..861ab1e5c 100644 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -787,16 +787,6 @@ void Plot2d_ViewWindow::onPrintView() if ( !myViewFrame ) return; -#if !defined(WIN32) && !defined(QT_NO_CUPS) -#if QT_VERSION < 0x040303 - if ( !Qtx::hasAnyPrinters() ) { - SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), - tr( "WRN_NO_PRINTERS" ) ); - return; - } -#endif -#endif - // stored settings for further starts static QString aPrinterName; static int aColorMode = -1; diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index 30fda906e..b2dc37dac 100644 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -38,9 +38,7 @@ #include #include #include -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) #include -#endif #include #include @@ -2108,7 +2106,6 @@ long Qtx::versionToId( const QString& version ) The function tries to detect qt installation directory by analyzing the system variables in the following order: - QT5_ROOT_DIR - - QT4_ROOT_DIR - QT_ROOT_DIR - QTDIR @@ -2121,7 +2118,7 @@ long Qtx::versionToId( const QString& version ) QString Qtx::qtDir( const QString& context ) { - QStringList vars = { "QT5_ROOT_DIR", "QT4_ROOT_DIR", "QT_ROOT_DIR", "QTDIR" }; + QStringList vars = { "QT5_ROOT_DIR", "QT_ROOT_DIR", "QTDIR" }; QString qtPath; for (uint i = 0; i < vars.length() && qtPath.isEmpty(); i++ ) { qtPath = getenv(vars[i]); @@ -2242,8 +2239,6 @@ Qt::HANDLE Qtx::getVisual() #endif // WIN32 - -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) /*! \brief Set default QSurfaceFormat for an application. @@ -2279,7 +2274,6 @@ void Qtx::initDefaultSurfaceFormat() QSurfaceFormat::setDefaultFormat(fmt); } -#endif /*! \class Qtx::CmdLineArgs diff --git a/src/Qtx/Qtx.h b/src/Qtx/Qtx.h index 25d4010c8..042ca830b 100644 --- a/src/Qtx/Qtx.h +++ b/src/Qtx/Qtx.h @@ -285,10 +285,7 @@ public: static void* getDisplay(); static Qt::HANDLE getVisual(); #endif - -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) static void initDefaultSurfaceFormat(); -#endif }; #endif diff --git a/src/Qtx/QtxDialog.cxx b/src/Qtx/QtxDialog.cxx index bcc038ad7..dae191431 100644 --- a/src/Qtx/QtxDialog.cxx +++ b/src/Qtx/QtxDialog.cxx @@ -1442,9 +1442,6 @@ void QtxDialog::reject() void QtxDialog::emitSignal() { QApplication::instance()->processEvents(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QApplication::syncX(); -#endif int id = buttonId( (QAbstractButton*)mySender ); mySender = 0; diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index e71b1bdcc..eae7e4aac 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -30,49 +30,6 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - -/*! - \brief Used for comparing of two QVariant values. - \param v1 first argument for comparison - \param v2 second argument for comparison - \return \c true if \a v1 less than \a v2 -*/ -bool operator<( const QVariant& v1, const QVariant& v2 ) -{ - QVariant::Type t1 = v1.type(), t2 = v2.type(); - if ( t1 == t2 ) - { - switch( t1 ) - { - case QVariant::Int: - return v1.toInt() < v2.toInt(); - case QVariant::Double: - return v1.toDouble() < v2.toDouble(); - case QVariant::String: - return v1.toString() < v2.toString(); - case QVariant::StringList: - case QVariant::List: - { - const QList& aList1 = v1.toList(), aList2 = v2.toList(); - QList::const_iterator anIt1 = aList1.begin(), aLast1 = aList1.end(), - anIt2 = aList2.begin(), aLast2 = aList2.end(); - for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) - { - if ( (*anIt1) != (*anIt2) ) - return (*anIt1) < (*anIt2); - } - return anIt1 == aLast1 && anIt2 != aLast2; - } - default: - return v1.toString() < v2.toString(); - } - } - return t1 < t2; -} - -#else - bool operator<( const QList& v1, const QList& v2 ) { QList::const_iterator anIt1 = v1.begin(), aLast1 = v1.end(), @@ -85,8 +42,6 @@ bool operator<( const QList& v1, const QList& v2 ) return anIt1 == aLast1 && anIt2 != aLast2; } -#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - /*! \class QtxPopupMgr::PopupCreator \internal diff --git a/src/Qtx/QtxTranslator.cxx b/src/Qtx/QtxTranslator.cxx index 4c36d1a6f..38a83cbd8 100644 --- a/src/Qtx/QtxTranslator.cxx +++ b/src/Qtx/QtxTranslator.cxx @@ -63,25 +63,6 @@ QtxTranslator::~QtxTranslator() { } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - -/*! - \brief Returns the translation for the key. - \param context message context - \param sourceText message source name - \param disambiguation message comment (optional) - \return Translated text if found or \a sourceText otherwise -*/ -QString QtxTranslator::translate( const char* context, const char* sourceText, const char* disambiguation ) const -{ - QString res = QTranslator::translate( context, sourceText, disambiguation ); - if ( res.isNull() ) - res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, disambiguation ); - return res; -} - -#else - /*! \brief Returns the translation for the key. \param context message context @@ -98,4 +79,3 @@ QString QtxTranslator::translate( const char* context, const char* sourceText, c return res; } -#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) diff --git a/src/Qtx/QtxTranslator.h b/src/Qtx/QtxTranslator.h index 2a47e3df1..1ecdff538 100644 --- a/src/Qtx/QtxTranslator.h +++ b/src/Qtx/QtxTranslator.h @@ -32,11 +32,7 @@ class QTX_EXPORT QtxTranslator : public QTranslator public: QtxTranslator( QObject* parent = 0 ); ~QtxTranslator(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - virtual QString translate( const char*, const char*, const char* = 0 ) const; -#else virtual QString translate( const char*, const char*, const char* = 0, int = -1 ) const; -#endif }; #endif diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index a485e6d23..1147f4349 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -107,17 +107,10 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) QVariant appropriate = model()->headerData( i, orientation(), Qtx::AppropriateRole ); QIcon icon; if ( iconData.isValid() ) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - if ( iconData.canConvert( QVariant::Icon ) ) - icon = iconData.value(); - else if ( iconData.canConvert( QVariant::Pixmap ) ) - icon = iconData.value(); -#else if ( iconData.canConvert( QMetaType::QIcon ) ) icon = iconData.value(); else if ( iconData.canConvert( QMetaType::QPixmap ) ) icon = iconData.value(); -#endif } if( ( !lab.isEmpty() || !icon.isNull() ) && appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true ) @@ -143,11 +136,7 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) } else if ( a && a == sortAction ) { setSortIndicatorShown( a->isChecked() ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - setClickable( a->isChecked() ); -#else setSectionsClickable( a->isChecked() ); -#endif QtxTreeView* view = qobject_cast( parent() ); if ( view ) { view->emitSortingEnabled( a->isChecked() ); @@ -192,11 +181,7 @@ QtxTreeView::QtxTreeView( QWidget* parent ) : QTreeView( parent ) { setHeader( new Header( false, this ) ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - header()->setMovable( true ); -#else header()->setSectionsMovable( true ); -#endif } /*! @@ -208,11 +193,7 @@ QtxTreeView::QtxTreeView( const bool enableSortMenu, QWidget* parent ) : QTreeView( parent ) { setHeader( new Header( enableSortMenu, this ) ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - header()->setMovable( true ); -#else header()->setSectionsMovable( true ); -#endif } /*! diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index f8127f9b8..749c89879 100644 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -131,13 +131,9 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool setWindowIcon( parent->windowIcon() ); // GDD -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation))); - myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))); -#else myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation))); myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); -#endif + setSidebarUrls(myUrls); // add quick directories widgets diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 3b1f804ab..8feae8ad9 100644 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -500,9 +500,7 @@ SUIT_TreeModel::~SUIT_TreeModel() void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, const int custom_id ) { bool found = false; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) beginResetModel(); -#endif for ( int i=0, n=myColumns.size(); i= QT_VERSION_CHECK(4, 6, 0) endResetModel(); -#else - reset(); -#endif } } @@ -540,18 +534,12 @@ void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, co void SUIT_TreeModel::unregisterColumn( const int group_id, const QString& name ) { for ( int i = 0, n = myColumns.size(); i < n; i++ ) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) beginResetModel(); -#endif if ( myColumns[i].myName == name ) { myColumns[i].myIds.remove( group_id ); if ( myColumns[i].myIds.isEmpty() ) { myColumns.remove( i ); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) endResetModel(); -#else - reset(); -#endif } break; } @@ -760,10 +748,7 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) { if ( root() == r ) return; - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) beginResetModel(); -#endif if ( autoDeleteTree() ) { SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ), @@ -784,11 +769,7 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) myRoot = r; //initialize(); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) endResetModel(); -#else - reset(); -#endif emit modelUpdated(); } @@ -2318,8 +2299,6 @@ void SUIT_ItemDelegate::paint( QPainter* painter, QSize SUIT_ItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const { QSize size = QItemDelegate::sizeHint ( option, index ); -#if QT_VERSION >= 0x040500 size.setHeight( size.height() + 1 ); -#endif return size; } diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index c3b31f35d..cc8c3cfb6 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -179,28 +179,17 @@ int main( int argc, char* argv[] ) } } -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) + // RNV: setup the default format: // QSurfaceFormat should be set before creation of QApplication, // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats // (see void Qtx::initDefaultSurfaceFormat()) and set the resultant format here. Qtx::initDefaultSurfaceFormat(); -#endif // add /plugins directory to the pluins search path for image plugins QString qtdir = Qtx::qtDir( "plugins" ); if ( !qtdir.isEmpty() ) QApplication::addLibraryPath( qtdir ); - -// 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(remote.length() > 0 || client.length() > 0 ) { - QApplication::setGraphicsSystem(QLatin1String("native")); - } -#endif SUITApp_Application app( argc, argv ); QString cfgAppName = getAppName( argList.isEmpty() ? QString() : argList.first() ); diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 6e89be1fe..2816250ea 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -40,29 +40,11 @@ Constructor */ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand ) -// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 -#if !defined(WIN32) && !defined(__APPLE__) && (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 - : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ), -#else : QApplication( argc, argv ), -#endif 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 ) - : QApplication( argc, argv, type ), -myExceptHandler( hand ) -{ -} -#endif /*! Sends event to receiver \return the value that is returned from the receiver's event handler diff --git a/src/SUITApp/SUITApp_Application.h b/src/SUITApp/SUITApp_Application.h index 27b4221c3..c6d9b31c0 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -43,10 +43,6 @@ class SUITAPP_EXPORT SUITApp_Application : public QApplication public: SUITApp_Application( int&, char**, 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&, char**, Type, SUIT_ExceptionHandler* = 0 ); -#endif virtual bool notify( QObject* receiver, QEvent* e ); SUIT_ExceptionHandler* handler() const; diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index c8ac1e87d..e7026ded2 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -35,9 +35,7 @@ // Put Qt includes before the X11 includes which #define the symbol None // (see SVTK_SpaceMouse.h) to avoid the compilation error. #if !defined(WIN32) && !defined(__APPLE__) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include -#endif #include #endif #include @@ -113,16 +111,10 @@ QVTK_RenderWindowInteractor ::~QVTK_RenderWindowInteractor() { #if !defined WIN32 && !defined __APPLE__ -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); - if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) - aSpaceMouse->close( QX11Info::display() ); -#else SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) aSpaceMouse->close( QX11Info::connection() ); #endif -#endif } @@ -417,17 +409,6 @@ QVTK_RenderWindowInteractor #if !defined WIN32 && !defined __APPLE__ // register set space mouse events receiver -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); - if ( aSpaceMouse ) - { - if ( !aSpaceMouse->isSpaceMouseOn() ) - // initialize 3D space mouse driver - aSpaceMouse->initialize( QX11Info::display(), winId() ); - else - aSpaceMouse->setWindow( QX11Info::display(), winId() ); - } -#else SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); if ( aSpaceMouse ) { @@ -438,7 +419,6 @@ QVTK_RenderWindowInteractor aSpaceMouse->setWindow( QX11Info::connection(), winId() ); } #endif -#endif } /*! @@ -452,69 +432,12 @@ QVTK_RenderWindowInteractor QWidget::focusOutEvent( event ); #if !defined WIN32 && !defined __APPLE__ -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - // unregister set space mouse events receiver - SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); - if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) - aSpaceMouse->setWindow( QX11Info::display(), 0 ); -#else SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) aSpaceMouse->setWindow( QX11Info::connection(), 0 ); #endif -#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 defined(WIN32) - -/*! - To handle native Win32 events (from such devices as SpaceMouse) -*/ -bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) -{ - // TODO: Implement event handling for SpaceMouse - return QWidget::winEvent( msg, result); } -#elif !defined(__APPLE__) -/*! - To handle native X11 events (from such devices as SpaceMouse) -*/ -bool -QVTK_RenderWindowInteractor -::x11Event( XEvent *xEvent ) -{ - // handle 3d space mouse events - if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() ) - { - if ( aSpaceMouse->isSpaceMouseOn() && xEvent->type == ClientMessage ) - { - SVTK_SpaceMouse::MoveEvent anEvent; - int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); - switch ( type ) - { - case SVTK_SpaceMouse::SpaceMouseMove: - GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data ); - break; - case SVTK_SpaceMouse::SpaceButtonPress: - GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button ); - break; - case SVTK_SpaceMouse::SpaceButtonRelease: - break; - } - return true; // stop handling the event - } - } - - return QWidget::x11Event( xEvent ); -} - -#endif - -#else // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - bool QVTK_RenderWindowInteractor ::nativeEvent(const QByteArray& eventType, void* message, long* result) { @@ -524,22 +447,12 @@ bool QVTK_RenderWindowInteractor if ( eventType == "xcb_generic_event_t" ) { xcb_generic_event_t* ev = static_cast(message); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - // TODO: this code is never called - if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() ) -#else if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() ) -#endif { if ( aSpaceMouse->isSpaceMouseOn() && ev->response_type == XCB_CLIENT_MESSAGE ) { SVTK_SpaceMouse::MoveEvent anEvent; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - // TODO: this code is never called - int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); -#else int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 ); -#endif switch ( type ) { case SVTK_SpaceMouse::SpaceMouseMove: @@ -558,7 +471,7 @@ bool QVTK_RenderWindowInteractor #endif return QWidget::nativeEvent( eventType, message, result ); } -#endif + /*! Constructor */ diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index c30efd2ee..feb30df6a 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -122,16 +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) -#if defined(WIN32) - virtual bool winEvent( MSG*, long* ); -#elif !defined(__APPLE__) - virtual bool x11Event( XEvent *e ); -#endif -#else virtual bool nativeEvent( const QByteArray&, void*, long* ); -#endif vtkSmartPointer myRenderWindow; vtkSmartPointer myDevice; }; diff --git a/src/SVTK/SVTK_SpaceMouse.cxx b/src/SVTK/SVTK_SpaceMouse.cxx index eea14c671..4541bcfa4 100644 --- a/src/SVTK/SVTK_SpaceMouse.cxx +++ b/src/SVTK/SVTK_SpaceMouse.cxx @@ -35,20 +35,12 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#else #include #endif -#endif #include "SVTK_SpaceMouse.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -SVTK_SpaceMouseX* SVTK_SpaceMouseX::myInstance = 0; -#else SVTK_SpaceMouseXCB* SVTK_SpaceMouseXCB::myInstance = 0; -#endif /*! Constructor @@ -57,174 +49,6 @@ SVTK_SpaceMouse::SVTK_SpaceMouse() { spaceMouseOn = 0; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -/*! - Constructor -*/ -SVTK_SpaceMouseX::SVTK_SpaceMouseX() -: SVTK_SpaceMouse() -{ -#if !defined WIN32 && !defined __APPLE__ - win = InputFocus; -#endif -} - -/*! - \return shared instance of object (creates if there is no one) -*/ -SVTK_SpaceMouseX* SVTK_SpaceMouseX::getInstance() -{ - if ( !myInstance ) - myInstance = new SVTK_SpaceMouseX(); - return myInstance; -} - -#if !defined WIN32 && !defined __APPLE__ - -static int errorCallback( Display *display, XErrorEvent *Error ) -{ - char msg[ 128 ]; - if ( Error->error_code != BadWindow ) { - XGetErrorText( display,Error->error_code,msg,sizeof( msg ) ); - fprintf( stderr, "SpaceMouse reported error = %s. Exit ... \n", msg ); - } - return 0; -} - -/*! - Initialization -*/ -int SVTK_SpaceMouseX::initialize( Display *display, Window window ) -{ - XMotionEvent = XInternAtom( display, "MotionEvent", 1 ); - XButtonPressEvent = XInternAtom( display, "ButtonPressEvent", 1 ); - XButtonReleaseEvent = XInternAtom( display, "ButtonReleaseEvent", 1 ); - XCommandEvent = XInternAtom( display, "CommandEvent", 1 ); - - spaceMouseOn = (XMotionEvent != 0) && - (XButtonPressEvent != 0) && - (XButtonReleaseEvent != 0) && - (XCommandEvent != 0); - if ( !spaceMouseOn ) - return 0; - - spaceMouseOn = setWindow( display, window ); - if ( !spaceMouseOn ) - return 0; - - return spaceMouseOn; -} - -/*! - Initialize by window -*/ -int SVTK_SpaceMouseX::setWindow( Display *display, Window window ) -{ - XTextProperty winName; - XEvent xEvent; - Atom type; - int format; - unsigned long NItems, BytesReturn; - unsigned char *PropReturn; - Window root; - int (*errorHandler)(Display *,XErrorEvent *); - - errorHandler = XSetErrorHandler( errorCallback ); - - root = RootWindow( display, DefaultScreen(display) ); - - PropReturn = NULL; - XGetWindowProperty( display, root, XCommandEvent, 0,1, 0, - AnyPropertyType, &type, &format, &NItems, - &BytesReturn, &PropReturn ); - - win = InputFocus; - if ( PropReturn != NULL ) { - win = *(Window *) PropReturn; - XFree( PropReturn ); - } - else - return 0; - - if ( XGetWMName( display, win, &winName ) == 0 ) - return 0; - - if ( strcmp( (char *) "Magellan Window", (char *) winName.value) != 0 ) - return 0; - - xEvent.type = ClientMessage; - xEvent.xclient.format = 16; - xEvent.xclient.send_event = 0; - xEvent.xclient.display = display; - xEvent.xclient.window = win; - xEvent.xclient.message_type = XCommandEvent; - - xEvent.xclient.data.s[0] = (short) ((window>>16)&0x0000FFFF); - xEvent.xclient.data.s[1] = (short) (window&0x0000FFFF); - xEvent.xclient.data.s[2] = 27695; - - if ( XSendEvent( display, win, 0, 0x0000, &xEvent ) == 0 ) - return 0; - - XFlush( display ); - - XSetErrorHandler( errorHandler ); - return 1; -} - -/*! - Close -*/ -int SVTK_SpaceMouseX::close(Display *display) -{ - initialize( display, (Window)InputFocus ); - spaceMouseOn = 0; - - return 1; -} - -/*! - Custom event handler -*/ -int SVTK_SpaceMouseX::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent, - double scale, double rScale ) -{ - if ( !spaceMouseOn ) - return 0; - - if ( xEvent->type == ClientMessage ) { - if ( xEvent->xclient.message_type == XMotionEvent ) { - spaceMouseEvent->type = SpaceMouseMove; - spaceMouseEvent->data[ x ] = - xEvent->xclient.data.s[2] * scale; - spaceMouseEvent->data[ y ] = - xEvent->xclient.data.s[3] * scale; - spaceMouseEvent->data[ z ] = - xEvent->xclient.data.s[4] * scale; - spaceMouseEvent->data[ a ] = - xEvent->xclient.data.s[5] * rScale; - spaceMouseEvent->data[ b ] = - xEvent->xclient.data.s[6] * rScale; - spaceMouseEvent->data[ c ] = - xEvent->xclient.data.s[7] * rScale; - spaceMouseEvent->period = xEvent->xclient.data.s[8]; - return 1; - } - else if ( xEvent->xclient.message_type == XButtonPressEvent ) { - spaceMouseEvent->type = SpaceButtonPress; - spaceMouseEvent->button = xEvent->xclient.data.s[2]; - return 2; - } - else if ( xEvent->xclient.message_type == XButtonReleaseEvent ) { - spaceMouseEvent->type = SpaceButtonRelease; - spaceMouseEvent->button = xEvent->xclient.data.s[2]; - return 3; - } - } - return (!display); -} -#endif -#else /*! Constructor @@ -399,4 +223,3 @@ int SVTK_SpaceMouseXCB::translateEvent( xcb_connection_t* connection, xcb_client return (!connection); } #endif -#endif diff --git a/src/SVTK/SVTK_SpaceMouse.h b/src/SVTK/SVTK_SpaceMouse.h index 18e2eacd4..40d7fe8b9 100644 --- a/src/SVTK/SVTK_SpaceMouse.h +++ b/src/SVTK/SVTK_SpaceMouse.h @@ -33,11 +33,7 @@ extern "C" { #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#else #include -#endif } #endif @@ -64,37 +60,6 @@ class SVTK_SpaceMouse int spaceMouseOn; }; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - -class SVTK_SpaceMouseX: public SVTK_SpaceMouse -{ - -public: - SVTK_SpaceMouseX(); - - // access to SpaceMouse utility class - static SVTK_SpaceMouseX* getInstance(); - -#if !defined WIN32 && !defined __APPLE__ - int initialize ( Display*, Window ); - int setWindow ( Display*, Window ); - int translateEvent ( Display*, XEvent*, MoveEvent*, double, double ); - int close ( Display* ); - -private: - Atom XMotionEvent; - Atom XButtonPressEvent; - Atom XButtonReleaseEvent; - Atom XCommandEvent; - Window win; -#endif - - static SVTK_SpaceMouseX* myInstance; - -}; - -#else - class SVTK_SpaceMouseXCB: public SVTK_SpaceMouse { @@ -122,4 +87,3 @@ private: }; #endif -#endif diff --git a/src/SalomeApp/SalomeApp_ListView.cxx b/src/SalomeApp/SalomeApp_ListView.cxx index 4606313be..62b52d73a 100644 --- a/src/SalomeApp/SalomeApp_ListView.cxx +++ b/src/SalomeApp/SalomeApp_ListView.cxx @@ -84,11 +84,7 @@ SalomeApp_ListView::SalomeApp_ListView( QWidget* parent ) setRootIsDecorated(false); setAllColumnsShowFocus(false); // header()->setClickEnabled(false); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - header()->setMovable(false); -#else header()->setSectionsMovable(false); -#endif myEditedItem = 0; myEdit = 0; diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index ea2748167..28092c9a9 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -263,13 +263,7 @@ class SALOME_QApplication : public QApplication public: SALOME_QApplication( int& argc, char** argv ) // TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 -#if !defined(WIN32) && !defined(__APPLE__) && (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 - : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ), -#else : QApplication( argc, argv ), -#endif myHandler ( 0 ) {} virtual bool notify( QObject* receiver, QEvent* e ) @@ -355,16 +349,6 @@ int main( int argc, char **argv ) SessionMsgHandler msgHandler; qInstallMessageHandler(QtxMsgHandler); -// 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(remote.length() > 0 || client.length() > 0 ) { - QApplication::setGraphicsSystem(QLatin1String("native")); - } -#endif - // add /plugins dir to the pluins search path for image plugins QString qtdir = Qtx::qtDir( "plugins" ); if ( !qtdir.isEmpty() ) @@ -384,15 +368,12 @@ int main( int argc, char **argv ) } } -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) - // RNV: setup the default format: // QSurfaceFormat should be set before creation of QApplication, // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats // (see void Qtx::initDefaultSurfaceFormat()) and set the resultant format here. Qtx::initDefaultSurfaceFormat(); -#endif // Create Qt application instance; // this should be done the very first! diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index 88733a2a3..2e3012529 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -1638,9 +1638,6 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, p->setPen(opt->palette.text().color()); } // Fall through! case PE_IndicatorViewItemCheck: -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - case PE_Q3CheckListIndicator: -#endif { if (!doRestore) { p->save(); @@ -2107,11 +2104,7 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, const QWidget* w ) const { if ( checkDebugLevel(10) ) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return BaseStyle::standardIconImplementation( standardIcon, opt, w ); -#else return QCommonStyle::standardIcon( standardIcon, opt, w ); -#endif } switch ( standardIcon ) @@ -2127,11 +2120,7 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, default: break; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return BaseStyle::standardIconImplementation( standardIcon, opt, w ); -#else return BaseStyle::standardIcon( standardIcon, opt, w ); -#endif } /*! diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h index 77a0f14e5..066d01ca9 100644 --- a/src/Style/Style_Salome.h +++ b/src/Style/Style_Salome.h @@ -25,13 +25,9 @@ #include #include "Style.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#define BaseStyle QWindowsStyle -#else #include #define BaseStyle QCommonStyle -#endif + class Style_Model; class QApplication; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index b64d4fd34..502ff86c2 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -29,7 +29,6 @@ IF(SALOME_USE_PYCONSOLE) SET(PYCONSOLE_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "") SET(PYCONSOLE_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "") SET(PYCONSOLE_INSTALL_RES "${SALOME_GUI_INSTALL_RES_DATA}" CACHE PATH "") - OPTION(PYCONSOLE_BUILD_WITH_QT5 "Build PyConsole with Qt 5" ${SALOME_BUILD_WITH_QT5}) ADD_SUBDIRECTORY(../tools/PyConsole) # will bring in PyInterp automatically ENDIF(SALOME_USE_PYCONSOLE) @@ -41,7 +40,6 @@ IF(SALOME_USE_PYVIEWER) SET(PYEDITOR_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "") SET(PYEDITOR_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "") SET(PYEDITOR_INSTALL_RES "${SALOME_GUI_INSTALL_RES_DATA}" CACHE PATH "") - OPTION(PYEDITOR_BUILD_WITH_QT5 "Build PyEditor with Qt 5" ${SALOME_BUILD_WITH_QT5}) ADD_SUBDIRECTORY(PyEditor) ENDIF(SALOME_USE_PYVIEWER) diff --git a/tools/PyConsole/CMakeLists.txt b/tools/PyConsole/CMakeLists.txt index 2e639d297..829884192 100644 --- a/tools/PyConsole/CMakeLists.txt +++ b/tools/PyConsole/CMakeLists.txt @@ -44,7 +44,6 @@ INCLUDE(SalomeSetupPlatform) # Options # ======= -OPTION(PYCONSOLE_BUILD_WITH_QT5 "Build PYCONSOLE with Qt 5" ON) OPTION(PYCONSOLE_BUILD_PYTHON "Build Python wrapping for PyConsole" ON) # @@ -55,24 +54,14 @@ FIND_PACKAGE(SalomePythonInterp REQUIRED) FIND_PACKAGE(SalomePythonLibs REQUIRED) # Qt -IF(NOT PYCONSOLE_BUILD_WITH_QT5) - FIND_PACKAGE(SalomeQt4 REQUIRED) -ELSE() - FIND_PACKAGE(SalomeQt5 REQUIRED) -ENDIF() - +FIND_PACKAGE(SalomeQt5 REQUIRED) IF(PYCONSOLE_BUILD_PYTHON) # Sip FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP PYCONSOLE_BUILD_PYTHON) # PyQt - IF (NOT PYCONSOLE_BUILD_WITH_QT5) - FIND_PACKAGE(SalomePyQt4 REQUIRED) - SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt4 PYCONSOLE_BUILD_PYTHON) - ELSE() - FIND_PACKAGE(SalomePyQt5 REQUIRED) - SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYCONSOLE_BUILD_PYTHON) - ENDIF() + FIND_PACKAGE(SalomePyQt5 REQUIRED) + SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYCONSOLE_BUILD_PYTHON) ENDIF(PYCONSOLE_BUILD_PYTHON) # Detection report @@ -94,7 +83,6 @@ SET(PYCONSOLE_INSTALL_RES share/resources CACHE PATH "Install path: PyConsole re SET(PYINTERP_INSTALL_LIBS "${PYCONSOLE_INSTALL_LIBS}" CACHE PATH "") SET(PYINTERP_INSTALL_HEADERS "${PYCONSOLE_INSTALL_HEADERS}" CACHE PATH "") SET(PYINTERP_INSTALL_RES "${PYCONSOLE_INSTALL_RES}" CACHE PATH "") -OPTION(PYINTERP_BUILD_WITH_QT5 "Build PYCONSOLE with Qt 5" ${PYCONSOLE_BUILD_WITH_QT5}) ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/../PyInterp ${PROJECT_BINARY_DIR}/PyInterp) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/../PyInterp/src) diff --git a/tools/PyEditor/CMakeLists.txt b/tools/PyEditor/CMakeLists.txt index 92b14f6cb..414c8ea80 100644 --- a/tools/PyEditor/CMakeLists.txt +++ b/tools/PyEditor/CMakeLists.txt @@ -44,7 +44,6 @@ INCLUDE(SalomeSetupPlatform) # Options # ======= -OPTION(PYEDITOR_BUILD_WITH_QT5 "Build PyEditor with Qt 5" ON) OPTION(PYEDITOR_BUILD_SHARED_LIBS "Build shared libraries for PyEditor" ON) OPTION(PYEDITOR_BUILD_EXE "Build PyEditor's executable" ON) OPTION(PYEDITOR_BUILD_PYTHON "Build Python wrapping for PyEditor" ON) @@ -60,12 +59,7 @@ ELSE(PYEDITOR_BUILD_SHARED_LIBS) ENDIF(PYEDITOR_BUILD_SHARED_LIBS) # Qt -IF(NOT PYEDITOR_BUILD_WITH_QT5) - FIND_PACKAGE(SalomeQt4 REQUIRED) -ELSE() - FIND_PACKAGE(SalomeQt5 REQUIRED) -ENDIF() - +FIND_PACKAGE(SalomeQt5 REQUIRED) IF(PYEDITOR_BUILD_PYTHON) # Python FIND_PACKAGE(SalomePythonInterp REQUIRED) @@ -76,13 +70,8 @@ IF(PYEDITOR_BUILD_PYTHON) FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP PYEDITOR_BUILD_PYTHON) # PyQt - IF (NOT PYEDITOR_BUILD_WITH_QT5) - FIND_PACKAGE(SalomePyQt4 REQUIRED) - SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt4 PYEDITOR_BUILD_PYTHON) - ELSE() - FIND_PACKAGE(SalomePyQt5 REQUIRED) - SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYEDITOR_BUILD_PYTHON) - ENDIF() + FIND_PACKAGE(SalomePyQt5 REQUIRED) + SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYEDITOR_BUILD_PYTHON) ENDIF(PYEDITOR_BUILD_PYTHON) # Detection report diff --git a/tools/PyInterp/CMakeLists.txt b/tools/PyInterp/CMakeLists.txt index 45131eaef..2b5da6adb 100644 --- a/tools/PyInterp/CMakeLists.txt +++ b/tools/PyInterp/CMakeLists.txt @@ -44,7 +44,6 @@ INCLUDE(SalomeSetupPlatform) # Options # ======= -OPTION(PYINTERP_BUILD_WITH_QT5 "Build PYINTERP with Qt 5" ON) # # Set list of prerequisites @@ -53,11 +52,7 @@ OPTION(PYINTERP_BUILD_WITH_QT5 "Build PYINTERP with Qt 5" ON) FIND_PACKAGE(SalomePythonInterp REQUIRED) FIND_PACKAGE(SalomePythonLibs REQUIRED) # Qt -IF(NOT PYINTERP_BUILD_WITH_QT5) - FIND_PACKAGE(SalomeQt4 REQUIRED) -ELSE() - FIND_PACKAGE(SalomeQt5 REQUIRED) -ENDIF() +FIND_PACKAGE(SalomeQt5 REQUIRED) # Detection report SALOME_PACKAGE_REPORT_AND_CHECK()