8000 Merge pull request #14571 from meeseeksmachine/auto-backport-of-pr-14… · matplotlib/matplotlib@ba79a57 · GitHub
[go: up one dir, main page]

Skip to content

Commit ba79a57

Browse files
authored
Merge pull request #14571 from meeseeksmachine/auto-backport-of-pr-14566-on-v3.1.x
Backport PR #14566 on branch v3.1.x (Move setting of AA_EnableHighDpiScaling before creating QApplication.)
2 parents 703132d + f9bec3a commit ba79a57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ 8000 -118,6 +118,11 @@ def _create_qApp():
118118
if display is None or not re.search(r':\d', display):
119119
raise RuntimeError('Invalid DISPLAY variable')
120120

121+
try:
122+
QtWidgets.QApplication.setAttribute(
123+
QtCore.Qt.AA_EnableHighDpiScaling)
124+
except AttributeError: # Attribute only exists for Qt>=5.6.
125+
pass
121126
qApp = QtWidgets.QApplication([b"matplotlib"])
122127
qApp.lastWindowClosed.connect(qApp.quit)
123128
else:
@@ -126,7 +131,6 @@ def _create_qApp():
126131
if is_pyqt5():
127132
try:
128133
qApp.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
129-
qApp.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
130134
except AttributeError:
131135
pass
132136

0 commit comments

Comments
 (0)
0