Skip to content

Commit faf1a42

Browse files
authored
Merge pull request #16840 from anntzer/depqt4
Deprecate support for Qt4.
2 parents d462a47 + 7fb2d38 commit faf1a42

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

doc/api/next_api_changes/deprecations.rst

+4
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,7 @@ attribute are deprecated.
391391
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
392392
This method is deprecated. Use the ``GridSpec.nrows``, ``GridSpec.ncols``,
393393
``SubplotSpec.rowspan``, and ``SubplotSpec.colspan`` properties instead.
394+
395+
Qt4-based backends
396+
~~~~~~~~~~~~~~~~~~
397+
The qt4agg and qt4cairo backends are deprecated.

lib/matplotlib/backends/backend_qt4.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
from .. import cbook
12
from .backend_qt5 import (
23
backend_version, SPECIAL_KEYS, SUPER, ALT, CTRL, SHIFT, MODIFIER_KEYS,
34
cursord, _create_qApp, _BackendQT5, TimerQT, MainWindow, FigureCanvasQT,
45
FigureManagerQT, NavigationToolbar2QT, SubplotToolQt, exception_handler)
56

67

8+
cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")
9+
10+
711
@_BackendQT5.export
812
class _BackendQT4(_BackendQT5):
913
class FigureCanvas(FigureCanvasQT):

lib/matplotlib/backends/backend_qt4agg.py

+4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
Render to qt from agg
33
"""
44

5+
from .. import cbook
56
from .backend_qt5agg import (
67
_BackendQT5Agg, FigureCanvasQTAgg, FigureManagerQT, NavigationToolbar2QT)
78

89

10+
cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")
11+
12+
913
@_BackendQT5Agg.export
1014
class _BackendQT4Agg(_BackendQT5Agg):
1115
class FigureCanvas(FigureCanvasQTAgg):

lib/matplotlib/backends/backend_qt4cairo.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
from .. import cbook
12
from .backend_qt5cairo import _BackendQT5Cairo, FigureCanvasQTCairo
23

34

5+
cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")
6+
7+
48
@_BackendQT5Cairo.export
59
class _BackendQT4Cairo(_BackendQT5Cairo):
610
class FigureCanvas(FigureCanvasQTCairo):

lib/matplotlib/backends/qt_compat.py

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
it; i.e. if the Qt5Agg backend is requested but QT_API is set to "pyqt4",
1010
then actually use Qt5 with PyQt5 or PySide2 (whichever can be imported);
1111
- otherwise, use whatever the rcParams indicate.
12+
13+
Support for PyQt4 is deprecated.
1214
"""
1315

1416
from distutils.version import LooseVersion
@@ -175,3 +177,6 @@ def is_pyqt5():
175177
ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
176178
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))
177179
QT_RC_MAJOR_VERSION = 5 if is_pyqt5() else 4
180+
181+
if not is_pyqt5():
182+
mpl.cbook.warn_deprecated("3.3", name="support for Qt4")

0 commit comments

Comments
 (0)