slint::platform::Platform Class
class Platform;#include <slint-platform.h>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.
Public Types
Section titled “Public Types” Clipboard
Section titled “ Clipboard”enum class Clipboard
| Value | Description |
|---|---|
DefaultClipboard | |
SelectionClipboard |
The type of clipboard used in Platform::clipboard_text and PLatform::set_clipboard_text.
Public Functions
Section titled “Public Functions” ~Platform (virtual)
Section titled “ ~Platform (virtual)”slint::platform::Platform::~Platform()=default
Platform
Section titled “ Platform”slint::platform::Platform::Platform(const Platform &)=delete
operator=
Section titled “ operator=”Platform & slint::platform::Platform::operator=(const Platform &)=delete
Platform
Section titled “ Platform”slint::platform::Platform::Platform()=default
create_window_adapter (pure virtual)
Section titled “ create_window_adapter (pure virtual)”std::unique_ptr<WindowAdapter> slint::platform::Platform::create_window_adapter()=0
Returns a new WindowAdapter.
duration_since_start (pure virtual)
Section titled “ duration_since_start (pure virtual)”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
set_clipboard_text (virtual)
Section titled “ set_clipboard_text (virtual)”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
clipboard_text (virtual)
Section titled “ clipboard_text (virtual)”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
run_event_loop (virtual)
Section titled “ run_event_loop (virtual)”void slint::platform::Platform::run_event_loop()
Spins an event loop and renders the visible windows.
quit_event_loop (virtual)
Section titled “ quit_event_loop (virtual)”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
run_in_event_loop (virtual)
Section titled “ run_in_event_loop (virtual)”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