Skip to content

Deprecate support for Qt4. #16840

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
Mar 25, 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
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,7 @@ attribute are deprecated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method is deprecated. Use the ``GridSpec.nrows``, ``GridSpec.ncols``,
``SubplotSpec.rowspan``, and ``SubplotSpec.colspan`` properties instead.

Qt4-based backends
~~~~~~~~~~~~~~~~~~
The qt4agg and qt4cairo backends are deprecated.
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/backend_qt4.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from .. import cbook
from .backend_qt5 import (
backend_version, SPECIAL_KEYS, SUPER, ALT, CTRL, SHIFT, MODIFIER_KEYS,
cursord, _create_qApp, _BackendQT5, TimerQT, MainWindow, FigureCanvasQT,
FigureManagerQT, NavigationToolbar2QT, SubplotToolQt, exception_handler)


cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")


@_BackendQT5.export
class _BackendQT4(_BackendQT5):
class FigureCanvas(FigureCanvasQT):
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/backend_qt4agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
Render to qt from agg
"""

from .. import cbook
from .backend_qt5agg import (
_BackendQT5Agg, FigureCanvasQTAgg, FigureManagerQT, NavigationToolbar2QT)


cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")


@_BackendQT5Agg.export
class _BackendQT4Agg(_BackendQT5Agg):
class FigureCanvas(FigureCanvasQTAgg):
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/backend_qt4cairo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from .. import cbook
from .backend_qt5cairo import _BackendQT5Cairo, FigureCanvasQTCairo


cbook.warn_deprecated("3.3", name=__name__, obj_type="backend")


@_BackendQT5Cairo.export
class _BackendQT4Cairo(_BackendQT5Cairo):
class FigureCanvas(FigureCanvasQTCairo):
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/backends/qt_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
it; i.e. if the Qt5Agg backend is requested but QT_API is set to "pyqt4",
then actually use Qt5 with PyQt5 or PySide2 (whichever can be imported);
- otherwise, use whatever the rcParams indicate.
Support for PyQt4 is deprecated.
"""

from distutils.version import LooseVersion
Expand Down Expand Up @@ -175,3 +177,6 @@ def is_pyqt5():
ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))
QT_RC_MAJOR_VERSION = 5 if is_pyqt5() else 4

if not is_pyqt5():
mpl.cbook.warn_deprecated("3.3", name="support for Qt4")