From 897bc573e307203008cc39045db573c1b62bdbf1 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 21 May 2020 00:37:46 +0200 Subject: [PATCH] Use qVersion, not QT_VERSION_STR -- the latter doesn't exist in PySide2. --- doc/api/api_changes_3.3/deprecations.rst | 2 +- examples/user_interfaces/embedding_in_qt_sgskip.py | 2 +- lib/matplotlib/backends/backend_qt5.py | 6 +++--- lib/matplotlib/backends/qt_compat.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/api_changes_3.3/deprecations.rst b/doc/api/api_changes_3.3/deprecations.rst index b31fe3096a63..25c611068977 100644 --- a/doc/api/api_changes_3.3/deprecations.rst +++ b/doc/api/api_changes_3.3/deprecations.rst @@ -545,7 +545,7 @@ The ``cbid`` and ``locator`` attribute are deprecated. Use ``qt_compat.is_pyqt5`` ~~~~~~~~~~~~~~~~~~~~~~ This function is deprecated in prevision of the future release of PyQt6. The -Qt version can be checked using ``QtCore.QT_VERSION_STR``. +Qt version can be checked using ``QtCore.qVersion()``. Reordering of parameters by `.Artist.set` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/user_interfaces/embedding_in_qt_sgskip.py b/examples/user_interfaces/embedding_in_qt_sgskip.py index 360bb525ad1c..8994c079943d 100644 --- a/examples/user_interfaces/embedding_in_qt_sgskip.py +++ b/examples/user_interfaces/embedding_in_qt_sgskip.py @@ -15,7 +15,7 @@ import numpy as np from matplotlib.backends.qt_compat import QtCore, QtWidgets -if QtCore.QT_VERSION_STR >= "5.": +if QtCore.qVersion() >= "5.": from matplotlib.backends.backend_qt5agg import ( FigureCanvas, NavigationToolbar2QT as NavigationToolbar) else: diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index e33bcb83a306..104207d1f089 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -105,7 +105,7 @@ def _create_qApp(): app = QtWidgets.QApplication.instance() if app is None: # check for DISPLAY env variable on X11 build of Qt - if QtCore.QT_VERSION_STR >= "5.": + if QtCore.qVersion() >= "5.": try: importlib.import_module( # i.e. PyQt5.QtX11Extras or PySide2.QtX11Extras. @@ -331,7 +331,7 @@ def mouseReleaseEvent(self, event): FigureCanvasBase.button_release_event(self, x, y, button, guiEvent=event) - if QtCore.QT_VERSION_STR >= "5.": + if QtCore.qVersion() >= "5.": def wheelEvent(self, event): x, y = self.mouseEventCoords(event) # from QWheelEvent::delta doc @@ -688,7 +688,7 @@ def basedir(self): return str(cbook._get_data_path('images')) def _icon(self, name): - if QtCore.QT_VERSION_STR >= '5.': + if QtCore.qVersion() >= '5.': name = name.replace('.png', '_large.png') pm = QtGui.QPixmap(str(cbook._get_data_path('images', name))) qt_compat._setDevicePixelRatio(pm, qt_compat._devicePixelRatio(self)) diff --git a/lib/matplotlib/backends/qt_compat.py b/lib/matplotlib/backends/qt_compat.py index 42dd55d944c0..12797b602872 100644 --- a/lib/matplotlib/backends/qt_compat.py +++ b/lib/matplotlib/backends/qt_compat.py @@ -85,7 +85,7 @@ def _isdeleted(obj): return not shiboken2.isValid(obj) raise ValueError("Unexpected value for the 'backend.qt5' rcparam") _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName - @mpl.cbook.deprecated("3.3", alternative="QtCore.QT_VERSION_STR") + @mpl.cbook.deprecated("3.3", alternative="QtCore.qVersion()") def is_pyqt5(): return True @@ -145,7 +145,7 @@ def _isdeleted(obj): return not shiboken.isValid(obj) raise ValueError("Unexpected value for the 'backend.qt4' rcparam") QtWidgets = QtGui - @mpl.cbook.deprecated("3.3", alternative="QtCore.QT_VERSION_STR") + @mpl.cbook.deprecated("3.3", alternative="QtCore.qVersion()") def is_pyqt5(): return False