slint.language

class KeyboardModifiers(builtins.tuple):

The KeyboardModifiers struct provides booleans to indicate possible modifier keys on a keyboard, such as Shift, Control, etc. It is provided as part of KeyEvent's modifiers field.

Keyboard shortcuts on Apple platforms typically use the Command key (⌘), such as Command+C for "Copy". On other platforms the same shortcut is typically represented using Control+C. To make it easier to develop cross-platform applications, on macOS, Slint maps the Command key to the control modifier, and the Control key to the meta modifier.

On Windows, the Windows key is mapped to the meta modifier.

KeyboardModifiers( alt: bool = False, control: bool = False, shift: bool = False, meta: bool = False)

Create new instance of KeyboardModifiers(alt, control, shift, meta)

alt: bool

Indicates the Alt key on a keyboard.

control: bool

Indicates the Control key on a keyboard, except on macOS, where it is the Command key (⌘).

shift: bool

Indicates the Shift key on a keyboard.

meta: bool

Indicates the Control key on macos, and the Windows key on Windows.

class PointerEvent(builtins.tuple):

Represents a Pointer event sent by the windowing system. This structure is passed to the pointer-event callback of the TouchArea element.

PointerEvent( button: Any = None, kind: Any = None, modifiers: Any = None, touch_finger_id: int = 0)

Create new instance of PointerEvent(button, kind, modifiers, touch_finger_id)

button: Any

The button that was pressed or released

kind: Any

The kind of the event

modifiers: Any

The keyboard modifiers pressed during the event

touch_finger_id: int

The unique ID of the touch point, indicating the finger ID. 0 means it's not a touch event (e.g., mouse).

class PointerScrollEvent(builtins.tuple):

Represents a Pointer scroll (or wheel) event sent by the windowing system. This structure is passed to the scroll-event callback of the TouchArea element.

PointerScrollEvent(delta_x: float = 0.0, delta_y: float = 0.0, modifiers: Any = None)

Create new instance of PointerScrollEvent(delta_x, delta_y, modifiers)

delta_x: float

The amount of pixel in the horizontal direction

delta_y: float

The amount of pixel in the vertical direction

modifiers: Any

The keyboard modifiers pressed during the event

class KeyEvent(builtins.tuple):

This structure is generated and passed to the key press and release callbacks of the FocusScope element.

KeyEvent(text: str = '', modifiers: Any = None, repeat: bool = False)

Create new instance of KeyEvent(text, modifiers, repeat)

text: str

The unicode representation of the key pressed.

modifiers: Any

The keyboard modifiers active at the time of the key press event.

repeat: bool

This field is set to true for key press events that are repeated, i.e. the key is held down. It's always false for key release events.

class DropEvent(builtins.tuple):

This structure is passed to the callbacks of the DropArea element

DropEvent( data: ForwardRef('DataTransfer | None') = None, position: ForwardRef('LogicalPosition | None') = None, allow_copy: bool = False, allow_move: bool = False, allow_link: bool = False, proposed_action: ForwardRef('DragAction | None') = None)

Create new instance of DropEvent(data, position, allow_copy, allow_move, allow_link, proposed_action)

data: DataTransfer | None

The payload set on the source DragArea.

position: LogicalPosition | None

The cursor position in the DropArea's local coordinates.

allow_copy: bool

Mirrors DragArea.allow-copy: true if the source allows the drop to copy the data.

allow_move: bool

Mirrors DragArea.allow-move: true if the source allows the drop to move the data.

proposed_action: DragAction | None

The action negotiated from current modifier state and the source's preferred-action, clamped to the allowed set. Updated on every DragMove. The target's can-drop callback can return this to honor the user's modifier choice, or override with any other allowed action.

class StandardListViewItem(builtins.tuple):

Represents an item in a StandardListView and a StandardTableView.

StandardListViewItem(text: str = '')

Create new instance of StandardListViewItem(text,)

text: str

The text content of the item

class RadioEntry(builtins.tuple):

Represents one option in a RadioGroup.

RadioEntry(text: str = '', disabled: bool = False)

Create new instance of RadioEntry(text, disabled)

text: str

Label shown next to the radio button.

disabled: bool

When true, this option is visible but not selectable.

class PointerEventKind(enum.Enum):

The enum reports what happened to the PointerEventButton in the event

cancel = <PointerEventKind.cancel: 'cancel'>

The action was cancelled.

down = <PointerEventKind.down: 'down'>

The button was pressed.

up = <PointerEventKind.up: 'up'>

The button was released.

move = <PointerEventKind.move: 'move'>

The pointer has moved,

class PointerEventButton(enum.Enum):

This enum describes the different types of buttons for a pointer event, typically on a mouse or a pencil.

other = <PointerEventButton.other: 'other'>

A button that is none of left, right, middle, back or forward. For example, this is used for the task button on a mouse with many buttons.

left = <PointerEventButton.left: 'left'>

The left button.

right = <PointerEventButton.right: 'right'>

The right button.

middle = <PointerEventButton.middle: 'middle'>

The center button.

back = <PointerEventButton.back: 'back'>

The back button.

forward = <PointerEventButton.forward: 'forward'>

The forward button.

class ColorScheme(enum.Enum):

This enum indicates the color scheme used by the widget style. Use this to explicitly switch between dark and light schemes, or choose Unknown to fall back to the system default.

unknown = <ColorScheme.unknown: 'unknown'>

The scheme is not known and a system wide setting configures this. This could mean that the widgets are shown in a dark or light scheme, but it could also be a custom color scheme.

dark = <ColorScheme.dark: 'dark'>

The style chooses light colors for the background and dark for the foreground.

light = <ColorScheme.light: 'light'>

The style chooses dark colors for the background and light for the foreground.

class DragAction(enum.Enum):

This enum describes the action negotiated between the source of a drag (DragArea) and its target (DropArea) during a drag-and-drop operation. The source declares which actions it permits, the target picks one in its can-drop callback, and the chosen action is reported back to the source via drag-finished so that, for example, a move source can remove the original data. The same enum is used for drags that come from another application or window once native drag-and-drop is in play.

none = <DragAction.none: 'none'>

No action: the drag is rejected, no drop will be delivered.

copy = <DragAction.copy: 'copy'>

The data is copied to the target; the source retains it.

move = <DragAction.move: 'move'>

The data is moved to the target; the source should remove it once the operation completes.