Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use qVersion, not QT_VERSION_STR -- the latter doesn't exist in PySide2. #17469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/api_changes_3.3/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion examples/user_interfaces/embedding_in_qt_sgskip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/qt_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down