From 88e4410af11ecb53f616f1d98f5f9ee49827ccd5 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 20 Sep 2016 09:45:28 +1000 Subject: [PATCH] Require Qt >= 5.5 --- CMakeLists.txt | 93 ++++++------------- ci/travis/linux/qt5/install.sh | 2 - cmake/FindPythonLibrary.cmake | 6 +- cmake/FindQCA.cmake | 6 +- cmake/FindQScintilla.cmake | 6 +- cmake/FindQsci.cmake | 21 +---- cmake/FindQwt.cmake | 6 +- cmake/PyQtMacros.cmake | 12 +-- python/CMakeLists.txt | 7 -- python/PyQt/CMakeLists.txt | 6 +- python/ext-libs/CMakeLists.txt | 33 +------ python/plugins/CMakeLists.txt | 31 +++---- src/app/main.cpp | 11 --- src/core/auth/qgsauthcertutils.cpp | 2 - src/core/auth/qgsauthcertutils.h | 8 -- src/core/dxf/qgsdxfpaintdevice.cpp | 2 - src/core/qgis.h | 40 -------- src/core/qgsexpression.cpp | 8 -- src/core/qgsfontutils.cpp | 2 - src/core/qgsmaplayermodel.cpp | 2 - src/core/qgsmaplayermodel.h | 2 - src/core/qgsproviderregistry.cpp | 20 ---- src/core/qgsproviderregistry.h | 10 -- src/core/qgsstringutils.cpp | 5 - src/gui/auth/qgsauthsslconfigwidget.cpp | 2 - src/gui/qgsattributeform.cpp | 8 -- src/gui/qgscolorschemelist.cpp | 4 - src/gui/qgstablewidgetitem.cpp | 4 - src/plugins/grass/qtermwidget/Session.cpp | 2 +- .../qgsdelimitedtextprovider.cpp | 6 -- .../postgres/qgspostgresprovider.cpp | 74 --------------- tests/src/core/testqgsauthconfig.cpp | 4 - tests/src/core/testqgsogcutils.cpp | 2 - 33 files changed, 58 insertions(+), 389 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f576e0f857..11de212a88d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,47 +246,28 @@ ELSE (WITH_QTWEBKIT) MESSAGE(STATUS "Qt WebKit support DISABLED.") ENDIF(WITH_QTWEBKIT) ############################################################# -# search for Qt4 -SET(QT_MIN_VERSION 4.8.0) -SET (ENABLE_QT5 FALSE CACHE BOOL "If enabled will try to find Qt5 before looking for Qt4") -IF (ENABLE_QT5) - FIND_PACKAGE(Qt5Core QUIET) - FIND_PACKAGE(Qt5Gui REQUIRED) - FIND_PACKAGE(Qt5Widgets REQUIRED) - FIND_PACKAGE(Qt5Network REQUIRED) - FIND_PACKAGE(Qt5Xml REQUIRED) - FIND_PACKAGE(Qt5Svg REQUIRED) - FIND_PACKAGE(Qt5Concurrent REQUIRED) - FIND_PACKAGE(Qt5PrintSupport REQUIRED) - FIND_PACKAGE(Qt5Positioning) - IF (WITH_QTWEBKIT) - FIND_PACKAGE(Qt5WebKit REQUIRED) - FIND_PACKAGE(Qt5WebKitWidgets REQUIRED) - ENDIF(WITH_QTWEBKIT) - FIND_PACKAGE(Qt5Test REQUIRED) - FIND_PACKAGE(Qt5UiTools REQUIRED) - FIND_PACKAGE(Qt5Script REQUIRED) - FIND_PACKAGE(Qt5Sql REQUIRED) - SET(QT5_BUILD TRUE) - INCLUDE("cmake/modules/ECMQt4To5Porting.cmake") - MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}") -ELSE() - FIND_PACKAGE(Qt4 ${QT_MIN_VERSION} REQUIRED) - SET(QT_USE_QTXML 1) - SET(QT_USE_QTNETWORK 1) - SET(QT_USE_QTSVG 1) - SET(QT_USE_QTSQL 1) - IF (WITH_QTWEBKIT) - SET(QT_USE_QTWEBKIT 1) - ENDIF(WITH_QTWEBKIT) - IF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR (WITH_QTWEBKIT AND NOT QT_QTWEBKIT_FOUND) OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND)) - MESSAGE(SEND_ERROR "Some Qt4 modules haven't been found!") - ENDIF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR (WITH_QTWEBKIT AND NOT QT_QTWEBKIT_FOUND) OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND)) - - INCLUDE( ${QT_USE_FILE} ) - - MESSAGE(STATUS "Found Qt version: ${QTVERSION}") -ENDIF() +# search for Qt5 +SET(QT_MIN_VERSION 5.5.0) +FIND_PACKAGE(Qt5Core QUIET) +FIND_PACKAGE(Qt5Gui REQUIRED) +FIND_PACKAGE(Qt5Widgets REQUIRED) +FIND_PACKAGE(Qt5Network REQUIRED) +FIND_PACKAGE(Qt5Xml REQUIRED) +FIND_PACKAGE(Qt5Svg REQUIRED) +FIND_PACKAGE(Qt5Concurrent REQUIRED) +FIND_PACKAGE(Qt5PrintSupport REQUIRED) +FIND_PACKAGE(Qt5Positioning) +IF (WITH_QTWEBKIT) +FIND_PACKAGE(Qt5WebKit REQUIRED) +FIND_PACKAGE(Qt5WebKitWidgets REQUIRED) +ENDIF(WITH_QTWEBKIT) +FIND_PACKAGE(Qt5Test REQUIRED) +FIND_PACKAGE(Qt5UiTools REQUIRED) +FIND_PACKAGE(Qt5Script REQUIRED) +FIND_PACKAGE(Qt5Sql REQUIRED) +SET(QT5_BUILD TRUE) +INCLUDE("cmake/modules/ECMQt4To5Porting.cmake") +MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}") IF (WITH_QTMOBILITY) FIND_PACKAGE(QtMobility 1.1.0) @@ -690,7 +671,7 @@ IF (UNIX AND NOT APPLE) SET (QGIS_MANUAL_DIR ${CMAKE_INSTALL_PREFIX}/${QGIS_MANUAL_SUBDIR}) ENDIF (UNIX AND NOT APPLE) -SET (DISABLE_DEPRECATED ${ENABLE_QT5} CACHE BOOL "If set to true, it will disable deprecated functionality to prepare for the next generation of QGIS") +SET (DISABLE_DEPRECATED FALSE CACHE BOOL "If set to true, it will disable deprecated functionality to prepare for the next generation of QGIS") IF (DISABLE_DEPRECATED) ADD_DEFINITIONS(-DQGIS_DISABLE_DEPRECATED) ENDIF (DISABLE_DEPRECATED) @@ -699,12 +680,7 @@ ENDIF (DISABLE_DEPRECATED) ############################################################# # Python build dependency -SET (ENABLE_PYTHON3 ${ENABLE_QT5} CACHE BOOL "If enabled will try to find Python 3 before looking for Python 2") -IF(ENABLE_PYTHON3) - SET(PYTHON_VER 3 CACHE STRING "Python version") -ELSE(ENABLE_PYTHON3) - SET(PYTHON_VER 2.7 CACHE STRING "Python version") -ENDIF(ENABLE_PYTHON3) +SET(PYTHON_VER 3 CACHE STRING "Python version") FIND_PACKAGE(PythonInterp ${PYTHON_VER} REQUIRED) @@ -715,17 +691,10 @@ IF (WITH_BINDINGS) FIND_PACKAGE(PythonLibrary REQUIRED) - # python support: check for interpreter, sip, pyqt4 - IF(ENABLE_QT5) - FIND_PACKAGE(PyQt5 REQUIRED) - SET(PYQT_SIP_FLAGS ${PYQT5_SIP_FLAGS}) - SET(PYQT_SIP_DIR ${PYQT5_SIP_DIR}) - ELSE(ENABLE_QT5) - FIND_PACKAGE(PyQt4 REQUIRED) - # setup SIP variables - SET(PYQT_SIP_FLAGS ${PYQT4_SIP_FLAGS}) - SET(PYQT_SIP_DIR ${PYQT4_SIP_DIR}) - ENDIF(ENABLE_QT5) + # python support: check for interpreter, sip, pyqt5 + FIND_PACKAGE(PyQt5 REQUIRED) + SET(PYQT_SIP_FLAGS ${PYQT5_SIP_FLAGS}) + SET(PYQT_SIP_DIR ${PYQT5_SIP_DIR}) SEPARATE_ARGUMENTS(PYQT_SIP_FLAGS) # convert space separated values to a list FIND_PACKAGE(SIP REQUIRED) @@ -742,11 +711,7 @@ IF (WITH_BINDINGS) ENDIF (NOT BINDINGS_GLOBAL_INSTALL) IF (WITH_CUSTOM_WIDGETS) - IF(ENABLE_QT5) - SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT5_MOD_DIR}/uic/widget-plugins/) - ELSE(ENABLE_QT5) - SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT4_MOD_DIR}/uic/widget-plugins/) - ENDIF(ENABLE_QT5) + SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT5_MOD_DIR}/uic/widget-plugins/) ENDIF (WITH_CUSTOM_WIDGETS) ENDIF (WITH_BINDINGS) diff --git a/ci/travis/linux/qt5/install.sh b/ci/travis/linux/qt5/install.sh index b361d009de9..7c0c274bf7b 100755 --- a/ci/travis/linux/qt5/install.sh +++ b/ci/travis/linux/qt5/install.sh @@ -51,8 +51,6 @@ cmake \ -DWITH_ASTYLE=ON \ -DWITH_SERVER=ON \ -DWITH_INTERNAL_YAML=OFF \ - -DENABLE_QT5=ON \ - -DENABLE_PYTHON3=ON \ -DDISABLE_DEPRECATED=ON \ -DPORT_PLUGINS=ON \ -DCXX_EXTRA_FLAGS="$CLANG_WARNINGS" \ diff --git a/cmake/FindPythonLibrary.cmake b/cmake/FindPythonLibrary.cmake index 660eecef8cf..fd5536339c9 100644 --- a/cmake/FindPythonLibrary.cmake +++ b/cmake/FindPythonLibrary.cmake @@ -44,11 +44,7 @@ else(EXISTS "${PYTHON_INCLUDE_PATH}" AND EXISTS "${PYTHON_LIBRARY}" AND EXISTS " endif("${PYTHON_CUSTOM_FRAMEWORK}" MATCHES "Python\\.framework") endif(APPLE AND PYTHON_CUSTOM_FRAMEWORK) - IF (ENABLE_PYTHON3) - FIND_PACKAGE(PythonInterp 3) - ELSE (ENABLE_PYTHON3) - FIND_PACKAGE(PythonInterp 2.7) - ENDIF (ENABLE_PYTHON3) + FIND_PACKAGE(PythonInterp 3) if(PYTHONINTERP_FOUND) FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH}) diff --git a/cmake/FindQCA.cmake b/cmake/FindQCA.cmake index 241ddc93fb0..3d99de595b1 100644 --- a/cmake/FindQCA.cmake +++ b/cmake/FindQCA.cmake @@ -20,11 +20,7 @@ if(QCA_INCLUDE_DIR AND QCA_LIBRARY) else(QCA_INCLUDE_DIR AND QCA_LIBRARY) - if(ENABLE_QT5) - set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5) - else(ENABLE_QT5) - set(QCA_LIBRARY_NAMES qca qca2) - endif(ENABLE_QT5) + set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5) find_library(QCA_LIBRARY NAMES ${QCA_LIBRARY_NAMES} diff --git a/cmake/FindQScintilla.cmake b/cmake/FindQScintilla.cmake index 9223ecac7ad..bde0f6676bd 100644 --- a/cmake/FindQScintilla.cmake +++ b/cmake/FindQScintilla.cmake @@ -33,11 +33,7 @@ ELSE(EXISTS QSCINTILLA_VERSION_STR) /usr/include ) - if(ENABLE_QT5) - set(QSCINTILLA_LIBRARY_NAMES qscintilla2-qt5 libqt5scintilla2 libqscintilla2-qt5 qt5scintilla2 libqscintilla2-qt5.dylib) - else(ENABLE_QT5) - set(QSCINTILLA_LIBRARY_NAMES qscintilla2 libqscintilla2 libqscintilla2.dylib) - endif(ENABLE_QT5) + set(QSCINTILLA_LIBRARY_NAMES qscintilla2-qt5 libqt5scintilla2 libqscintilla2-qt5 qt5scintilla2 libqscintilla2-qt5.dylib) find_library(QSCINTILLA_LIBRARY NAMES ${QSCINTILLA_LIBRARY_NAMES} diff --git a/cmake/FindQsci.cmake b/cmake/FindQsci.cmake index 0981ef0e3a3..fcb2bc11ce0 100644 --- a/cmake/FindQsci.cmake +++ b/cmake/FindQsci.cmake @@ -23,11 +23,7 @@ ELSE(EXISTS QSCI_MOD_VERSION_STR) FIND_FILE(_find_qsci_py FindQsci.py PATHS ${CMAKE_MODULE_PATH}) - IF(ENABLE_QT5) - SET(QSCI_VER 5) - ELSE(ENABLE_QT5) - SET(QSCI_VER 4) - ENDIF(ENABLE_QT5) + SET(QSCI_VER 5) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_qsci_py} ${QSCI_VER} OUTPUT_VARIABLE qsci_ver) @@ -37,17 +33,10 @@ ELSE(EXISTS QSCI_MOD_VERSION_STR) ENDIF(qsci_ver) IF(QSCI_FOUND) - IF(ENABLE_QT5) - FIND_PATH(QSCI_SIP_DIR - NAMES Qsci/qscimod5.sip - PATHS ${PYQT5_SIP_DIR} - ) - ELSE(ENABLE_QT5) - FIND_PATH(QSCI_SIP_DIR - NAMES Qsci/qscimod4.sip - PATHS ${PYQT4_SIP_DIR} - ) - ENDIF(ENABLE_QT5) + FIND_PATH(QSCI_SIP_DIR + NAMES Qsci/qscimod5.sip + PATHS ${PYQT5_SIP_DIR} + ) IF(NOT QSCI_FIND_QUIETLY) MESSAGE(STATUS "Found QScintilla2 PyQt module: ${QSCI_MOD_VERSION_STR}") diff --git a/cmake/FindQwt.cmake b/cmake/FindQwt.cmake index 5031bf2b9cf..13f3b5b09c7 100644 --- a/cmake/FindQwt.cmake +++ b/cmake/FindQwt.cmake @@ -20,11 +20,7 @@ FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS PATH_SUFFIXES qwt-qt4 qwt qwt5 qwt6 ) -if(ENABLE_QT5) - set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5) -else(ENABLE_QT5) - set(QWT_LIBRARY_NAMES qwt qwt6 qwt5 qwt-qt4 qwt6-qt4 qwt5-qt4) -endif(ENABLE_QT5) +set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5) find_library(QWT_LIBRARY NAMES ${QWT_LIBRARY_NAMES} diff --git a/cmake/PyQtMacros.cmake b/cmake/PyQtMacros.cmake index 0586ca51177..45679b737fd 100644 --- a/cmake/PyQtMacros.cmake +++ b/cmake/PyQtMacros.cmake @@ -4,15 +4,9 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -IF(ENABLE_QT5) - SET(PYUIC_PROG_NAME pyuic5) - SET(PYUIC_PROG_NAMES pyuic5) - SET(PYRCC_PROG_NAME pyrcc5) -ELSE(ENABLE_QT5) - SET(PYUIC_PROG_NAME pyuic4) - SET(PYUIC_PROG_NAMES python2-pyuic4 pyuic4) - SET(PYRCC_PROG_NAME pyrcc4) -ENDIF(ENABLE_QT5) +SET(PYUIC_PROG_NAME pyuic5) +SET(PYUIC_PROG_NAMES pyuic5) +SET(PYRCC_PROG_NAME pyrcc5) IF(NOT PYUIC_PROGRAM) IF (MSVC) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 0c474d5eaa6..f54f4a4621c 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -121,10 +121,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h ) -IF(NOT ENABLE_QT5) - SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QT5_SUPPORT) -ENDIF(NOT ENABLE_QT5) - IF(NOT ANDROID) SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} ANDROID) ENDIF(NOT ANDROID) @@ -146,9 +142,6 @@ IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600 SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY) ENDIF(PYQT4_VERSION_NUM LESS 263680) -IF(NOT PYQT4_VERSION_NUM LESS 263941 AND NOT ENABLE_QT5) # 0x040705 - SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QSETINT_CONVERSION) -ENDIF(NOT PYQT4_VERSION_NUM LESS 263941 AND NOT ENABLE_QT5) # IF(NOT PYQT4_VERSION_NUM LESS 264194) # 0x040802 SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QSETTYPE_CONVERSION) diff --git a/python/PyQt/CMakeLists.txt b/python/PyQt/CMakeLists.txt index 1520079061b..0a38790b51f 100644 --- a/python/PyQt/CMakeLists.txt +++ b/python/PyQt/CMakeLists.txt @@ -23,11 +23,7 @@ SET(PYQT_COMPAT_FILES ADD_CUSTOM_TARGET(pyqtcompat ALL) ADD_DEPENDENCIES(pyqtcompat pyutils) -IF(ENABLE_QT5) - SET(PYQT_PREFIX PyQt5) -ELSE(ENABLE_QT5) - SET(PYQT_PREFIX PyQt4) -ENDIF(ENABLE_QT5) +SET(PYQT_PREFIX PyQt5) FOREACH(pyfile ${PYQT_COMPAT_FILES}) GET_FILENAME_COMPONENT(_dir ${pyfile} PATH) diff --git a/python/ext-libs/CMakeLists.txt b/python/ext-libs/CMakeLists.txt index 473efef364d..49cb92fbac7 100644 --- a/python/ext-libs/CMakeLists.txt +++ b/python/ext-libs/CMakeLists.txt @@ -35,43 +35,12 @@ ENDMACRO(EXT_PYLIB lib) # Our yaml package is not compatible with python 3 # Fallback to system package by default -IF(PYTHON_VER VERSION_LESS 3) - EXT_PYLIB(yaml TRUE) -ELSEIF(PYTHON_VER VERSION_LESS 3) - EXT_PYLIB(yaml FALSE) -ENDIF(PYTHON_VER VERSION_LESS 3) +EXT_PYLIB(yaml FALSE) FOREACH(pkg httplib2 jinja2 markupsafe owslib pygments dateutil pytz nose2 requests) EXT_PYLIB(${pkg} TRUE) ENDFOREACH(pkg) -IF(NOT ENABLE_PYTHON3) - SET (WITH_INTERNAL_FUTURE TRUE CACHE BOOL "Determines whether python future should be included") - IF(WITH_INTERNAL_FUTURE) - ADD_CUSTOM_TARGET(pyfuture) - - FILE(GLOB items RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/future future/*) - - FOREACH(item ${items}) - INSTALL(DIRECTORY future/${item} DESTINATION "${QGIS_PYTHON_DIR}") - FILE(GLOB_RECURSE files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/future future/*) - ADD_CUSTOM_COMMAND(TARGET pyfuture - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${item} "${PYTHON_OUTPUT_DIRECTORY}/" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${files} - ) - PY_COMPILE(pyfuture "${PYTHON_OUTPUT_DIRECTORY}/${item}") - - ADD_CUSTOM_COMMAND(TARGET clean-staged-plugins - COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_OUTPUT_DIRECTORY}/${item}" - ) - ENDFOREACH(item ${items}) - - ADD_DEPENDENCIES(staged-plugins pyfuture) - ENDIF(WITH_INTERNAL_FUTURE) -ENDIF(NOT ENABLE_PYTHON3) - SET (WITH_INTERNAL_SIX TRUE CACHE BOOL "Determines whether python six should be included") IF(WITH_INTERNAL_SIX) INSTALL(FILES six.py DESTINATION "${QGIS_PYTHON_DIR}") diff --git a/python/plugins/CMakeLists.txt b/python/plugins/CMakeLists.txt index e52ac13656d..285cd82084c 100644 --- a/python/plugins/CMakeLists.txt +++ b/python/plugins/CMakeLists.txt @@ -8,17 +8,16 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/stagecount 0) -IF(ENABLE_QT5) - # The target port-plugins acts as a container for all port-plugin-XXX targets - # Each port-plugin-XXX target will run scripts/2to3 on a plugin and migrate - # Python 3 and Qt 5 code. - SET (PORT_PLUGINS FALSE CACHE BOOL "Determines whether python plugins in staged or installed locations should be migrated to Python 3 and Qt 5") - IF(PORT_PLUGINS) - ADD_CUSTOM_TARGET(port-plugins ALL) - ELSE(PORT_PLUGINS) - ADD_CUSTOM_TARGET(port-plugins) - ENDIF(PORT_PLUGINS) -ENDIF(ENABLE_QT5) +# The target port-plugins acts as a container for all port-plugin-XXX targets +# Each port-plugin-XXX target will run scripts/2to3 on a plugin and migrate +# Python 3 and Qt 5 code. +SET (PORT_PLUGINS FALSE CACHE BOOL "Determines whether python plugins in staged or installed locations should be migrated to Python 3 and Qt 5") +IF(PORT_PLUGINS) + ADD_CUSTOM_TARGET(port-plugins ALL) +ELSE(PORT_PLUGINS) + ADD_CUSTOM_TARGET(port-plugins) +ENDIF(PORT_PLUGINS) + MACRO (PLUGIN_INSTALL plugin subdir ) FILE(READ ${CMAKE_BINARY_DIR}/stagecount n) @@ -47,12 +46,10 @@ MACRO (PLUGIN_INSTALL plugin subdir ) ADD_CUSTOM_TARGET(staged-${plugin} DEPENDS zzz-${plugin}-stageinstall) FILE(WRITE ${_cmake} "") - IF(ENABLE_QT5) - ADD_CUSTOM_TARGET(port-plugin-${plugin}) - PY_2TO3(port-plugin-${plugin} ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}) - ADD_DEPENDENCIES(port-plugins port-plugin-${plugin}) - ADD_DEPENDENCIES(port-plugin-${plugin} staged-${plugin}) - ENDIF(ENABLE_QT5) + ADD_CUSTOM_TARGET(port-plugin-${plugin}) + PY_2TO3(port-plugin-${plugin} ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}) + ADD_DEPENDENCIES(port-plugins port-plugin-${plugin}) + ADD_DEPENDENCIES(port-plugin-${plugin} staged-${plugin}) ENDIF(NOT TARGET zzz-${plugin}-stageinstall) ADD_CUSTOM_TARGET(zzz-${plugin}-${n}-depend DEPENDS ${ARGN}) diff --git a/src/app/main.cpp b/src/app/main.cpp index 2fe8567fbea..598d01deffe 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -34,9 +34,6 @@ #include #include #include -#if QT_VERSION < 0x050000 -#include -#endif #include #include #include @@ -419,11 +416,9 @@ void myMessageOutput( QtMsgType type, const char *msg ) } -#if QT_VERSION >= 0x050500 case QtInfoMsg: myPrint( "Info: %s\n", msg ); break; -#endif } } @@ -949,12 +944,6 @@ int main( int argc, char *argv[] ) QApplication::setStyle( style ); mySettings.setValue( "/qgis/style", QApplication::style()->objectName() ); } -#ifdef Q_OS_WIN -#if QT_VERSION < 0x050000 - else - QApplication::setStyle( new QPlastiqueStyle ); -#endif -#endif /* Translation file for QGIS. */ diff --git a/src/core/auth/qgsauthcertutils.cpp b/src/core/auth/qgsauthcertutils.cpp index 0257eaa7eb6..af7262e4927 100644 --- a/src/core/auth/qgsauthcertutils.cpp +++ b/src/core/auth/qgsauthcertutils.cpp @@ -30,12 +30,10 @@ QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol ) { switch ( protocol ) { -#if QT_VERSION >= 0x040800 case QSsl::SecureProtocols: return QObject::tr( "SecureProtocols" ); case QSsl::TlsV1SslV3: return QObject::tr( "TlsV1SslV3" ); -#endif case QSsl::TlsV1: return QObject::tr( "TlsV1" ); case QSsl::SslV3: diff --git a/src/core/auth/qgsauthcertutils.h b/src/core/auth/qgsauthcertutils.h index 6832bbdf307..9f50eb40729 100644 --- a/src/core/auth/qgsauthcertutils.h +++ b/src/core/auth/qgsauthcertutils.h @@ -25,17 +25,9 @@ class QgsAuthConfigSslServer; -#if QT_VERSION >= 0x050000 #define SSL_ISSUER_INFO( var, prop ) var.issuerInfo( prop ).value(0) -#else -#define SSL_ISSUER_INFO( var, prop ) var.issuerInfo( prop ) -#endif -#if QT_VERSION >= 0x050000 #define SSL_SUBJECT_INFO( var, prop ) var.subjectInfo( prop ).value(0) -#else -#define SSL_SUBJECT_INFO( var, prop ) var.subjectInfo( prop ) -#endif /** \ingroup core * \brief Utilities for working with certificates and keys diff --git a/src/core/dxf/qgsdxfpaintdevice.cpp b/src/core/dxf/qgsdxfpaintdevice.cpp index 6eb8159dad0..b60afc7bba2 100644 --- a/src/core/dxf/qgsdxfpaintdevice.cpp +++ b/src/core/dxf/qgsdxfpaintdevice.cpp @@ -54,10 +54,8 @@ int QgsDxfPaintDevice::metric( PaintDeviceMetric metric ) const case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmPhysicalDpiY: return 96; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) case QPaintDevice::PdmDevicePixelRatio: return 1; -#endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) case QPaintDevice::PdmDevicePixelRatioScaled: return 1; diff --git a/src/core/qgis.h b/src/core/qgis.h index 13ee8bdc61e..4e9654e5466 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -125,21 +125,7 @@ class CORE_EXPORT Qgis // retrieved from QLibrary::resolve to function pointers. // It's assumed that this works on all systems supporting // QLibrary -#if QT_VERSION >= 0x050000 #define cast_to_fptr(f) f -#else -inline void ( *cast_to_fptr( void *p ) )() -{ - union - { - void *p; - void ( *f )(); - } u; - - u.p = p; - return u.f; -} -#endif /** \ingroup core * RAII signal blocking class. Used for temporarily blocking signals from a QObject @@ -267,32 +253,6 @@ CORE_EXPORT double qgsPermissiveToDouble( QString string, bool& ok ); */ CORE_EXPORT int qgsPermissiveToInt( QString string, bool& ok ); -// Add missing qHash implementation for QDate, QTime, QDateTime -// implementations taken from upstream Qt5 versions -#if QT_VERSION < 0x050000 - -//! Hash implementation for QDateTime -//! @note not available in Python bindings -inline uint qHash( const QDateTime &key ) -{ - return qHash( key.toMSecsSinceEpoch() ); -} - -//! Hash implementation for QDate -//! @note not available in Python bindings -inline uint qHash( const QDate &key ) -{ - return qHash( key.toJulianDay() ); -} - -//! Hash implementation for QTime -//! @note not available in Python bindings -inline uint qHash( const QTime &key ) -{ - return QTime( 0, 0, 0, 0 ).msecsTo( key ); -} -#endif - //! Compares two QVariant values and returns whether the first is less than the second. //! Useful for sorting lists of variants, correctly handling sorting of the various //! QVariant data types (such as strings, numeric values, dates and times) diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp index 61d70c0f047..18c8ac873ea 100644 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -55,10 +55,6 @@ #include "qgsmessagelog.h" #include "qgscsexception.h" -#if QT_VERSION < 0x050000 -#include -#endif - // from parser extern QgsExpression::Node* parseExpression( const QString& str, QString& parserErrorMsg ); @@ -4927,11 +4923,7 @@ QString QgsExpression::helpText( QString name ) if ( f.mType == tr( "group" ) ) name = group( name ); -#if QT_VERSION < 0x050000 - name = Qt::escape( name ); -#else name = name.toHtmlEscaped(); -#endif QString helpContents( QString( "

%1

\n

%2

" ) .arg( tr( "%1 %2" ).arg( f.mType, name ), diff --git a/src/core/qgsfontutils.cpp b/src/core/qgsfontutils.cpp index 9d4c30b4cce..2ee7403ee20 100644 --- a/src/core/qgsfontutils.cpp +++ b/src/core/qgsfontutils.cpp @@ -439,7 +439,6 @@ QString QgsFontUtils::asCSS( const QFont& font, double pointToPixelScale ) case QFont::Black: cssWeight = 900; break; -#if QT_VERSION >= 0x050500 case QFont::Thin: cssWeight = 100; break; @@ -452,7 +451,6 @@ QString QgsFontUtils::asCSS( const QFont& font, double pointToPixelScale ) case QFont::ExtraBold: cssWeight = 800; break; -#endif } css += QString( "font-weight: %1;" ).arg( cssWeight ); diff --git a/src/core/qgsmaplayermodel.cpp b/src/core/qgsmaplayermodel.cpp index 92be02a9c8b..150350e1072 100644 --- a/src/core/qgsmaplayermodel.cpp +++ b/src/core/qgsmaplayermodel.cpp @@ -216,7 +216,6 @@ QVariant QgsMapLayerModel::data( const QModelIndex &index, int role ) const return QVariant(); } -#if QT_VERSION >= 0x050000 QHash QgsMapLayerModel::roleNames() const { QHash roles = QAbstractItemModel::roleNames(); @@ -225,7 +224,6 @@ QHash QgsMapLayerModel::roleNames() const return roles; } -#endif Qt::ItemFlags QgsMapLayerModel::flags( const QModelIndex &index ) const { diff --git a/src/core/qgsmaplayermodel.h b/src/core/qgsmaplayermodel.h index bf64a57df16..db3de5079c8 100644 --- a/src/core/qgsmaplayermodel.h +++ b/src/core/qgsmaplayermodel.h @@ -88,14 +88,12 @@ class CORE_EXPORT QgsMapLayerModel : public QAbstractItemModel int columnCount( const QModelIndex &parent ) const override; QVariant data( const QModelIndex &index, int role ) const override; -#if QT_VERSION >= 0x050000 /** * Returns strings for all roles supported by this model. * * @note Available only with Qt5 (python and c++) */ QHash roleNames() const override; -#endif bool setData( const QModelIndex &index, const QVariant &value, int role ) override; Qt::ItemFlags flags( const QModelIndex &index ) const override; diff --git a/src/core/qgsproviderregistry.cpp b/src/core/qgsproviderregistry.cpp index a485d8aba49..14da0e1256e 100644 --- a/src/core/qgsproviderregistry.cpp +++ b/src/core/qgsproviderregistry.cpp @@ -432,7 +432,6 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey, return selectFactory( parent, fl ); } -#if QT_VERSION >= 0x050000 QFunctionPointer QgsProviderRegistry::function( QString const & providerKey, QString const & functionName ) { @@ -450,25 +449,6 @@ QFunctionPointer QgsProviderRegistry::function( QString const & providerKey, return 0; } } -#else -void *QgsProviderRegistry::function( QString const & providerKey, - QString const & functionName ) -{ - QLibrary myLib( library( providerKey ) ); - - QgsDebugMsg( "Library name is " + myLib.fileName() ); - - if ( myLib.load() ) - { - return myLib.resolve( functionName.toLatin1().data() ); - } - else - { - QgsDebugMsg( "Cannot load library: " + myLib.errorString() ); - return nullptr; - } -} -#endif QLibrary *QgsProviderRegistry::providerLibrary( QString const & providerKey ) const { diff --git a/src/core/qgsproviderregistry.h b/src/core/qgsproviderregistry.h index d8b7b762a41..9b9c85edd9e 100644 --- a/src/core/qgsproviderregistry.h +++ b/src/core/qgsproviderregistry.h @@ -84,7 +84,6 @@ class CORE_EXPORT QgsProviderRegistry QWidget *selectWidget( const QString & providerKey, QWidget * parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); -#if QT_VERSION >= 0x050000 /** Get pointer to provider function @param providerKey identificator of the provider @param functionName name of function @@ -92,15 +91,6 @@ class CORE_EXPORT QgsProviderRegistry */ QFunctionPointer function( const QString & providerKey, const QString & functionName ); -#else - /** Get pointer to provider function - * @param providerKey identificator of the provider - * @param functionName name of function - * @return pointer to function or NULL on error - */ - void *function( const QString & providerKey, - const QString & functionName ); -#endif QLibrary *providerLibrary( const QString & providerKey ) const; diff --git a/src/core/qgsstringutils.cpp b/src/core/qgsstringutils.cpp index 503c6fd71aa..9198fbfa854 100644 --- a/src/core/qgsstringutils.cpp +++ b/src/core/qgsstringutils.cpp @@ -45,13 +45,8 @@ QString QgsStringUtils::capitalize( const QString& string, QgsStringUtils::Capit wordSplitter.setPosition( 0 ); bool first = true; -#if QT_VERSION >= 0x050000 while (( first && wordSplitter.boundaryReasons() & QTextBoundaryFinder::StartOfItem ) || wordSplitter.toNextBoundary() >= 0 ) -#else - while (( first && wordSplitter.boundaryReasons() & QTextBoundaryFinder::StartWord ) - || wordSplitter.toNextBoundary() >= 0 ) -#endif { first = false; letterSplitter.setPosition( wordSplitter.position() ); diff --git a/src/gui/auth/qgsauthsslconfigwidget.cpp b/src/gui/auth/qgsauthsslconfigwidget.cpp index d56c32b2a57..58bb89e2b51 100644 --- a/src/gui/auth/qgsauthsslconfigwidget.cpp +++ b/src/gui/auth/qgsauthsslconfigwidget.cpp @@ -131,12 +131,10 @@ void QgsAuthSslConfigWidget::setUpSslConfigTree() // add config field names mProtocolItem = addRootItem( tr( "Protocol" ) ); mProtocolCmbBx = new QComboBox( treeSslConfig ); -#if QT_VERSION >= 0x040800 mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SecureProtocols ), ( int )QSsl::SecureProtocols ); mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1SslV3 ), ( int )QSsl::TlsV1SslV3 ); -#endif mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1 ), ( int )QSsl::TlsV1 ); mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SslV3 ), diff --git a/src/gui/qgsattributeform.cpp b/src/gui/qgsattributeform.cpp index 7811452b171..42ede61c64e 100644 --- a/src/gui/qgsattributeform.cpp +++ b/src/gui/qgsattributeform.cpp @@ -690,20 +690,12 @@ void QgsAttributeForm::onAttributeChanged( const QVariant& value ) if ( value.isNull() ) { // not good -#if QT_VERSION >= 0x050000 buddy->setText( QString( "%1" ).arg( text ) ); -#else - buddy->setText( QString( "%1*" ).arg( text ) ); -#endif } else { // good -#if QT_VERSION >= 0x050000 buddy->setText( QString( "%1" ).arg( text ) ); -#else - buddy->setText( QString( "%1*" ).arg( text ) ); -#endif } } } diff --git a/src/gui/qgscolorschemelist.cpp b/src/gui/qgscolorschemelist.cpp index db9f335ca06..94d3b68ebab 100644 --- a/src/gui/qgscolorschemelist.cpp +++ b/src/gui/qgscolorschemelist.cpp @@ -764,7 +764,6 @@ bool QgsColorSwatchDelegate::editorEvent( QEvent *event, QAbstractItemModel *mod QColor color = index.model()->data( index, Qt::DisplayRole ).value(); -#if QT_VERSION >= 0x050000 QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( qobject_cast< QWidget* >( parent() ) ); if ( panel && panel->dockMode() ) { @@ -776,7 +775,6 @@ bool QgsColorSwatchDelegate::editorEvent( QEvent *event, QAbstractItemModel *mod panel->openPanel( colorWidget ); return true; } -#endif QColor newColor = QgsColorDialog::getColor( color, mParent, tr( "Select color" ), true ); if ( !newColor.isValid() ) @@ -792,11 +790,9 @@ bool QgsColorSwatchDelegate::editorEvent( QEvent *event, QAbstractItemModel *mod void QgsColorSwatchDelegate::colorChanged() { -#if QT_VERSION >= 0x050000 if ( QgsCompoundColorWidget* colorWidget = qobject_cast< QgsCompoundColorWidget* >( sender() ) ) { QModelIndex index = colorWidget->property( "index" ).toModelIndex(); const_cast< QAbstractItemModel* >( index.model() )->setData( index, colorWidget->color(), Qt::EditRole ); } -#endif } diff --git a/src/gui/qgstablewidgetitem.cpp b/src/gui/qgstablewidgetitem.cpp index d0ef9c30b44..5815c1d0299 100644 --- a/src/gui/qgstablewidgetitem.cpp +++ b/src/gui/qgstablewidgetitem.cpp @@ -39,9 +39,5 @@ int QgsTableWidgetItem::sortRole() const bool QgsTableWidgetItem::operator<( const QTableWidgetItem& other ) const { -#if QT_VERSION < 0x050000 - return data( mSortRole ).toString() < other.data( mSortRole ).toString(); -#else return data( mSortRole ) < other.data( mSortRole ); -#endif } diff --git a/src/plugins/grass/qtermwidget/Session.cpp b/src/plugins/grass/qtermwidget/Session.cpp index 9e29377562e..c28ea48602c 100644 --- a/src/plugins/grass/qtermwidget/Session.cpp +++ b/src/plugins/grass/qtermwidget/Session.cpp @@ -139,7 +139,7 @@ WId Session::windowId() const // https://bugreports.qt-project.org/browse/QTBUG-41942 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - return 0; + return 0; #else if ( _views.count() == 0 ) { return 0; diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index 6e5a364d645..19f343619d7 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -26,9 +26,7 @@ #include #include #include -#if QT_VERSION >= 0x050000 #include -#endif #include "qgsapplication.h" #include "qgsdataprovider.h" @@ -155,12 +153,8 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( const QString& uri ) if ( url.hasQueryItem( "subset" ) ) { -#if QT_VERSION < 0x050000 - subset = url.queryItemValue( "subset" ); -#else // We need to specify FullyDecoded so that %25 is decoded as % subset = QUrlQuery( url ).queryItemValue( "subset" , QUrl::FullyDecoded ); -#endif QgsDebugMsg( "subset is: " + subset ); } diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index ad88b6fd1d6..4bfcb11403f 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -331,80 +331,6 @@ QString QgsPostgresProvider::storageType() const return "PostgreSQL database with PostGIS extension"; } -// Qt5 has that built in -// ... BUT it does not behave exactly the same way as our implementation -// (e.g. comparison of QVariantList does not work) -#if QT_VERSION < 0x050000 -static bool operator<( const QVariant &a, const QVariant &b ) -{ - // invalid < NULL < any value - if ( !a.isValid() ) - return b.isValid(); - else if ( a.isNull() ) - return b.isValid() && !b.isNull(); - else if ( !b.isValid() || b.isNull() ) - return false; - - if ( a.type() == b.type() ) - { - switch ( a.type() ) - { - case QVariant::Int: - case QVariant::Char: - return a.toInt() < b.toInt(); - - case QVariant::Double: - return a.toDouble() < b.toDouble(); - - case QVariant::LongLong: - return a.toLongLong() < b.toLongLong(); - - case QVariant::List: - case QVariant::StringList: - { - const QList al = a.toList(); - const QList bl = b.toList(); - - int i, n = qMin( al.size(), bl.size() ); - for ( i = 0; i < n && al[i].type() == bl[i].type() && al[i].isNull() == bl[i].isNull() && al[i] == bl[i]; i++ ) - ; - - if ( i == n ) - return al.size() < bl.size(); - else - return al[i] < bl[i]; - } - - case QVariant::Map: - return a.toMap() < b.toMap(); - - case QVariant::Date: - return a.toDate() < b.toDate(); - - case QVariant::Time: - return a.toTime() < b.toTime(); - - case QVariant::DateTime: - return a.toDateTime() < b.toDateTime(); - - case QVariant::Bool: - return a.toBool() < b.toBool(); - - case QVariant::UInt: - return a.toUInt() < b.toUInt(); - - case QVariant::ULongLong: - return a.toULongLong() < b.toULongLong(); - - default: - break; - } - } - - return a.canConvert( QVariant::String ) && b.canConvert( QVariant::String ) && a.toString() < b.toString(); -} -#endif - #if QT_VERSION >= 0x050000 && QT_VERSION < 0x050600 #include template diff --git a/tests/src/core/testqgsauthconfig.cpp b/tests/src/core/testqgsauthconfig.cpp index 6f5effbd1d0..e8371b01c11 100644 --- a/tests/src/core/testqgsauthconfig.cpp +++ b/tests/src/core/testqgsauthconfig.cpp @@ -205,11 +205,7 @@ void TestQgsAuthConfig::testConfigSslServer() QgsAuthConfigSslServer sslconfig; QVERIFY( sslconfig.isNull() ); -#if QT_VERSION >= 0x040800 QCOMPARE( sslconfig.qtVersion(), 480 ); -#else - QCOMPARE( sslconfig.qtVersion(), 470 ); -#endif QCOMPARE( sslconfig.version(), 1 ); QCOMPARE( sslconfig.sslPeerVerifyMode(), QSslSocket::VerifyPeer ); diff --git a/tests/src/core/testqgsogcutils.cpp b/tests/src/core/testqgsogcutils.cpp index ca1b8058c06..4b4e621e087 100644 --- a/tests/src/core/testqgsogcutils.cpp +++ b/tests/src/core/testqgsogcutils.cpp @@ -32,11 +32,9 @@ class TestQgsOgcUtils : public QObject void initTestCase() { -#if QT_VERSION >= 0x050000 // Needed on Qt 5 so that the serialization of XML is consistant among all executions extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; qt_qhash_seed.store( 0 ); -#endif // // Runs once before any tests are run