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.

Initialization

supports_gamepads

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: collections.abc.Callable[[int, int, int], None] | None) None

Register mouse button callback.

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: collections.abc.Callable[[int, int, int], None] | None) None

Register keyboard callback (key, action, mods).

set_cursor_pos_callback(callback: collections.abc.Callable[[float, float], None] | None) None

Register cursor position callback.

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

Register character input callback.

set_scroll_callback(callback: collections.abc.Callable[[float, float], None] | 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_cursor_shape(shape: int) None

Set cursor shape. 0=arrow, 1=ibeam, 2=crosshair, 3=hand, 4=hresize, 5=vresize.

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.