Skip to content

Fix qt backend on mac big sur #19334

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 3 commits into from
Jan 29, 2021
Merged
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
10 changes: 10 additions & 0 deletions lib/matplotlib/backends/qt_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from distutils.version import LooseVersion
import os
import platform
import sys

import matplotlib as mpl
Expand Down Expand Up @@ -180,6 +181,15 @@ def is_pyqt5():
raise AssertionError("Unexpected QT_API: {}".format(QT_API))


# Fixes issues with Big Sur
# https://bugreports.qt.io/browse/QTBUG-87014, fixed in qt 5.15.2
if (sys.platform == 'darwin' and
LooseVersion(platform.mac_ver()[0]) >= LooseVersion("10.16") and
Copy link
Member Author

@ericpre ericpre Jan 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this should be a >= or == and I don't know if we can even know how is it going to be with the next MacOS release...

LooseVersion(QtCore.qVersion()) < LooseVersion("5.15.2") and
"QT_MAC_WANTS_LAYER" not in os.environ):
os.environ["QT_MAC_WANTS_LAYER"] = "1"


# These globals are only defined for backcompatibility purposes.
ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))
Expand Down