Skip to content
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

PR: Add QtCharts alias for backward compatibility with 1.x #315

Merged
merged 3 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions qtpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ class PythonQtWarning(Warning):
except (ImportError, PythonQtError):
pass

try:
# QtCharts backward compatibility with QtPy 1.x
from . import QtCharts
QtCharts.QtCharts = QtCharts
except (ImportError, PythonQtError):
pass
CAM-Gerlach marked this conversation as resolved.
Show resolved Hide resolved


def _warn_old_minor_version(name, old_version, min_version):
"""Warn if using a Qt or binding version no longer supported by QtPy."""
Expand Down
1 change: 1 addition & 0 deletions qtpy/tests/test_qtcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ def test_qtcharts():
"""Test the qtpy.QtCharts namespace"""
from qtpy import QtCharts
assert QtCharts.QChart is not None
assert QtCharts.QtCharts.QChart is not None