Skip to content

Commit 910274f

Browse files
committed
PyQt window resize using incorrect viewport
PyQt reports resize values using the actual buffer size, not the scaled size.
1 parent bdfa3a0 commit 910274f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

demosys/context/pyqt/window.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,16 @@ def mouseMoveEvent(self, event):
115115
def resize(self, width, height):
116116
"""
117117
Pyqt specific resize callback.
118-
The window currently do not support resizing.
119118
"""
120119
if not self.fbo:
121120
return
122121

123-
self.width = width
124-
self.height = height
125-
self.buffer_width = self.width * self.widget.devicePixelRatio()
126-
self.buffer_height = self.height * self.widget.devicePixelRatio()
122+
# pyqt reports sizes in actual buffer size
123+
self.width = width // self.widget.devicePixelRatio()
124+
self.height = height // self.widget.devicePixelRatio()
125+
self.buffer_width = width
126+
self.buffer_height = height
127127

128-
print(width, height)
129128
super().resize(width, height)
130129

131130
def swap_buffers(self):

0 commit comments

Comments
 (0)