simvx.graphics.platform._qt

PySide6 windowing backend.

Module Contents

Classes

QtBackend

WindowBackend implementation using PySide6.

Data

API

simvx.graphics.platform._qt.log

‘getLogger(…)’

simvx.graphics.platform._qt.__all__

[‘QtBackend’]

class simvx.graphics.platform._qt.QtBackend

WindowBackend implementation using PySide6.

Every Qt input event carries the time the platform delivered it, in milliseconds on a clock whose zero the platform chooses, which

Class:

EventClock maps onto the monotonic clock the engine measures with. Qt says nothing about which keyboard or mouse an event came from: it aggregates them, as GLFW does, so events are reported on the aggregate device.

A finger and a pen are pointers of their own. QTouchEvent reaches the touch callback one point at a time and QTabletEvent the pen callback, each with only the measurements the device’s capabilities say are real, and both are accepted so Qt does not synthesise a mouse from them. A pen leaving the tablet’s range is reported to the application rather than the window, so a filter on the application hears it.

Initialization

supports_controllers

False

supports_rumble

False

create_window(width: int, height: int, title: str, *, visible: bool = True) → None

Create a QWindow with Vulkan surface.

visible=False builds the window without mapping it, for the headless and offscreen paths. The window still has a size and a surface, so the swapchain and every frame after it are unaffected.

create_graphics_surface(instance: Any) → Any

Create a Vulkan surface from the QWindow.

get_required_instance_extensions() → list[str]

The instance extensions the session Qt actually loaded needs.

poll_events() → None

Process Qt events.

should_close() → bool

Whether the frame loop should stop.

Visibility is deliberately not part of the answer. A window created with visible=False is never mapped, so reading isVisible() here would end the loop on its first check and render zero frames rather than the offscreen frames that were asked for.

get_framebuffer_size() → tuple[int, int]

Get window framebuffer size.

set_mouse_button_callback(callback: simvx.graphics.platform._base.MouseButtonCallback | None) → None

Register mouse button callback.

set_touch_callback(callback: simvx.graphics.platform._base.TouchCallback | None) → None

Register the finger callback: (finger_id, phase, x, y, pressure).

set_pen_callback(callback: simvx.graphics.platform._base.PenCallback | None) → None

Register the pen callback: (pen_id, phase, x, y) and what the tablet measured.

get_cursor_pos() → tuple[float, float]

Get current cursor position.

set_window_size(width: int, height: int) → None

Resize the window.

get_window_size() → tuple[int, int]

Get window size (may differ from framebuffer size on HiDPI).

get_content_scale() → tuple[float, float]
set_title(title: str) → None

Update the window title bar.

setTitle is QWindow’s spelling; setWindowTitle is QWidget’s and raises AttributeError here.

set_key_callback(callback: simvx.graphics.platform._base.KeyCallback | None) → None

Register keyboard callback (key, action, mods).

set_cursor_pos_callback(callback: simvx.graphics.platform._base.CursorPosCallback | None) → None

Register cursor position callback.

set_char_callback(callback: simvx.graphics.platform._base.CharCallback | None) → None

Register character input callback.

set_scroll_callback(callback: simvx.graphics.platform._base.ScrollCallback | None) → None

Register scroll wheel callback, in notches like the other backends.

set_resize_callback(callback: collections.abc.Callable[[int, int], None] | None) → None

Register framebuffer resize callback.

set_focus_callback(callback: collections.abc.Callable[[bool], None] | None) → None

Register the window focus callback (True on gain, False on loss).

set_cursor_shape(shape: simvx.core.input.enums.CursorShape) → None

Show shape over the window.

set_mouse_capture(mode: int) → None

Best-effort cursor capture for the QWindow (this backend is partial).

mode is a MouseCaptureMode int: 0=visible, 1=hidden, 2=captured, 3=confined. Attribute access is guarded so a missing method does not crash.

request_close() → None

Request the window to close.

destroy() → None

Clean up Qt resources.