Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3515d25

Browse files
authored
Merge pull request #19334 from ericpre/fix_mac_big_sur_qt
FIX: qt backend on mac big sur by setting ENVS
2 parents 0d735ca + 76e8260 commit 3515d25

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/backends/qt_compat.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from distutils.version import LooseVersion
1717
import os
18+
import platform
1819
import sys
1920

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

182183

184+
# Fixes issues with Big Sur
185+
# https://bugreports.qt.io/browse/QTBUG-87014, fixed in qt 5.15.2
186+
if (sys.platform == 'darwin' and
187+
LooseVersion(platform.mac_ver()[0]) >= LooseVersion("10.16") and
188+
LooseVersion(QtCore.qVersion()) < LooseVersion("5.15.2") and
189+
"QT_MAC_WANTS_LAYER" not in os.environ):
190+
os.environ["QT_MAC_WANTS_LAYER"] = "1"
191+
192+
183193
# These globals are only defined for backcompatibility purposes.
184194
ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
185195
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))

0 commit comments

Comments
 (0)