Skip to content

slint::platform::Platform Class

class Platform;
C++
#include <slint-platform.h>
C++

The platform acts as a factory to create WindowAdapter instances.

Call slint::platform::set_platform() before creating any other Slint handles. Any subsequently created Slint windows will use the WindowAdapter provided by the create_window_adapter function.

enum class Clipboard
ValueDescription
DefaultClipboard
SelectionClipboard

The type of clipboard used in Platform::clipboard_text and PLatform::set_clipboard_text.

slint::platform::Platform::~Platform()=default
slint::platform::Platform::Platform(const Platform &)=delete
Platform & slint::platform::Platform::operator=(const Platform &)=delete
slint::platform::Platform::Platform()=default
std::unique_ptr<WindowAdapter> slint::platform::Platform::create_window_adapter()=0

Returns a new WindowAdapter.

std::chrono::milliseconds slint::platform::Platform::duration_since_start()=0

Returns the amount of milliseconds since start of the application.

This function should only be implemented if the runtime is compiled with SLINT_FEATURE_FREESTANDING

void slint::platform::Platform::set_clipboard_text(const SharedString &, Clipboard)

Sends the given text into the system clipboard.

If the platform doesn’t support the specified clipboard, this function should do nothing

std::optional<SharedString> slint::platform::Platform::clipboard_text(Clipboard)

Returns a copy of text stored in the system clipboard, if any.

If the platform doesn’t support the specified clipboard, the function should return nullopt

void slint::platform::Platform::run_event_loop()

Spins an event loop and renders the visible windows.

void slint::platform::Platform::quit_event_loop()

Exits the event loop.

This is what is called by slint::quit_event_loop() and can be called from a different thread or re-enter from the event loop

void slint::platform::Platform::run_in_event_loop(Task)

Run a task from the event loop.

This function is called by slint::invoke_from_event_loop(). It can be called from any thread, but the passed function must only be called from the event loop. Reimplements this function and moves the event to the event loop before calling Task::run()


© 2026 SixtyFPS GmbH