Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/cube_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from rendercanvas.utils.cube import setup_drawing_sync


canvas = RenderCanvas(title=f"The wgpu cube example on {lib}", update_mode="continuous")
canvas = RenderCanvas(title=f"The wgpu cube example on {lib}", update_mode="fastest", present_method='screen')
draw_frame = setup_drawing_sync(canvas)
canvas.request_draw(draw_frame)

Expand Down
5 changes: 4 additions & 1 deletion rendercanvas/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ def _get_surface_ids(self):

def paintEngine(self): # noqa: N802 - this is a Qt method
# https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum WA_PaintOnScreen
if self._present_to_screen:
print(f"paintEngine called, _present_to_screen is {self._present_to_screen} ")
if self._present_to_screen or self._present_to_screen is None:
return None
else:
return super().paintEngine()
Expand Down Expand Up @@ -366,6 +367,8 @@ def _rc_get_present_info(self, present_methods):
if the_method == "screen":
surface_ids = self._get_surface_ids()
if surface_ids:
# Now is a good time to set WA_PaintOnScreen. Note that it implies WA_NativeWindow.
self.setAttribute(WA_PaintOnScreen, True)
self._present_to_screen = True
return {"method": "screen", **surface_ids}
elif "bitmap" in present_methods:
Expand Down
2 changes: 1 addition & 1 deletion rendercanvas/utils/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def setup_drawing_sync(
canvas, power_preference="high-performance", limits=None, format=None
canvas, power_preference="low-power", limits=None, format=None
) -> Callable[[], None]:
"""Setup to draw a rotating cube on the given canvas.

Expand Down
Loading