diff --git a/examples/cube_qt.py b/examples/cube_qt.py index 2530f8d..2d7e241 100644 --- a/examples/cube_qt.py +++ b/examples/cube_qt.py @@ -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) diff --git a/rendercanvas/qt.py b/rendercanvas/qt.py index e17cfeb..f5e5e3c 100644 --- a/rendercanvas/qt.py +++ b/rendercanvas/qt.py @@ -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() @@ -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: diff --git a/rendercanvas/utils/cube.py b/rendercanvas/utils/cube.py index dd6d03c..67cd22f 100644 --- a/rendercanvas/utils/cube.py +++ b/rendercanvas/utils/cube.py @@ -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.