Skip to content

Commit 2aee819

Browse files
almarkleinKorijn
andauthored
Prevent Qt warning about setting dpi awareness (#320)
Co-authored-by: Korijn van Golen <[email protected]>
1 parent fcae779 commit 2aee819

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

wgpu/gui/qt.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,16 @@
9898

9999
def enable_hidpi():
100100
"""Enable high-res displays."""
101+
try:
102+
set_dpi_aware = QtCore.__version_info__ < (6, 4)
103+
except Exception:
104+
set_dpi_aware = True
101105
try:
102106
# See https://github.com/pyzo/pyzo/pull/700 why we seem to need both
103-
ctypes.windll.shcore.SetProcessDpiAwareness(1) # global dpi aware
104-
ctypes.windll.shcore.SetProcessDpiAwareness(2) # per-monitor dpi aware
107+
# See https://github.com/pygfx/pygfx/issues/368 for high Qt versions
108+
if set_dpi_aware:
109+
ctypes.windll.shcore.SetProcessDpiAwareness(1) # global dpi aware
110+
ctypes.windll.shcore.SetProcessDpiAwareness(2) # per-monitor dpi aware
105111
except Exception:
106112
pass # fail on non-windows
107113
try:

0 commit comments

Comments
 (0)