// First, check if anything is already imported.
if "PyQt5" in sys.modules:
QT_API = QT_API_PYQT5
dict.__setitem__(rcParams, "backend.qt5", QT_API)
elif "PySide2" in sys.modules:
QT_API = QT_API_PYSIDE2
dict.__setitem__(rcParams, "backend.qt5", QT_API)
elif "PyQt4" in sys.modules:
After Change
// only override the binding, not the backend (in other words, we check that the
// requested backend actually matches).
elif rcParams["backend"] in ["Qt5Agg", "Qt5Cairo"]:
if QT_API_ENV in ["pyqt5", "pyside2"]:
QT_API = _ETS[QT_API_ENV]
else:
QT_API = None
elif rcParams["backend"] in ["Qt4Agg", "Qt4Cairo"]:
if QT_API_ENV in ["pyqt4", "pyside"]:
QT_API = _ETS[QT_API_ENV]
else: