8000 Merge pull request #14566 from anntzer/enablehighdpiscaling · matplotlib/matplotlib@90e25ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 90e25ec

Browse files
authored
Merge pull request #14566 from anntzer/enablehighdpiscaling
Move setting of AA_EnableHighDpiScaling before creating QApplication.
2 parents e53cb0e + f008360 commit 90e25ec

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
@@ -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