Skip to content

Commit

Permalink
Merge pull request #315 from dalthviz/fixes_issue_304
Browse files Browse the repository at this point in the history
PR: Add `QtCharts` alias for backward compatibility with 1.x
  • Loading branch information
CAM-Gerlach authored Jan 20, 2022
2 parents dfb64e1 + c0f73b9 commit 74dd309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qtpy/QtCharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
if PYQT5:
try:
from PyQt5.QtChart import *
from PyQt5 import QtChart as QtCharts
except ImportError as error:
raise PythonQtError(
'The QtChart module was not found. '
Expand All @@ -20,14 +21,17 @@
elif PYQT6:
try:
from PyQt6.QtCharts import *
from PyQt6 import QtCharts
except ImportError as error:
raise PythonQtError(
'The QtCharts module was not found. '
'It needs to be installed separately for PyQt6.'
) from error
elif PYSIDE6:
from PySide6.QtCharts import *
from PySide6 import QtCharts
elif PYSIDE2:
from PySide2.QtCharts import *
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide2.QtCharts as __temp
import inspect
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

0 comments on commit 74dd309

Please sign in to comment.