Ir al contenido

Referencia de controles

El diseñador ofrece 23 controles. Cada propiedad de esta página se puede cambiar en el panel Propiedades (o escribiendo una expresión con fx), y cada evento se conecta con Eventos → Crear: se agrega la función en main.rs (ver Conectar con Rust).

Todas las propiedades y eventos de esta página se comprueban con el compilador de Slint 1.19 en cada cambio del diseñador.

Propiedad En el panel Valor Por defecto
title Título texto —
width Ancho longitud (px) —
height Alto longitud (px) —
icon Ícono imagen —
background Fondo color —
default-font-size Tamaño de letra por defecto longitud (px) —
default-font-family Fuente por defecto texto —
default-font-weight Grosor por defecto opción: 100, 200, 300, 400, 500, 600, 700, 800, 900 400
always-on-top Siempre encima sí / no false
no-frame Sin marco (sin barra de título) sí / no false

Dentro de una columna, fila o cuadrícula, la posición la decide el layout. En lugar de X e Y aparecen:

Propiedad En el panel Valor Por defecto
width Ancho fijo longitud (px) —
height Alto fijo longitud (px) —
horizontal-stretch Crecer a lo ancho número —
vertical-stretch Crecer a lo alto número —
min-width Ancho mínimo longitud (px) —
max-width Ancho máximo longitud (px) —
min-height Alto mínimo longitud (px) —
max-height Alto máximo longitud (px) —

Slint no permite poner a la vez un ancho fijo y un ancho mínimo o máximo (ni lo mismo con el alto): al poner uno, el diseñador quita el otro.

Y dentro de una cuadrícula, además:

Propiedad En el panel Valor Por defecto
row Fila número entero 0
col Columna número entero 0
colspan Columnas que ocupa número entero 1
rowspan Filas que ocupa número entero 1
Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto (varias líneas) —
font-size Tamaño de letra longitud (px) 14px
font-weight Grosor opción: 100, 200, 300, 400, 500, 600, 700, 800, 900 400
font-family Fuente texto —
font-italic Cursiva sí / no false
letter-spacing Espaciado entre letras longitud (px) 0px
color Color color —
horizontal-alignment Alineación horizontal opción: left, center, right left
vertical-alignment Alineación vertical opción: top, center, bottom top
wrap Ajuste de línea opción: no-wrap, word-wrap, char-wrap no-wrap
overflow Si no cabe opción: clip, elide clip
stroke Contorno: color color —
stroke-width Contorno: grosor longitud (px) 0px
opacity Opacidad 0 a 1 1
visible Visible sí / no true

Usar desde Rust: text (SharedString).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto —
icon Ícono imagen —
primary Principal (color de acento) sí / no false
colorize-icon Colorear el ícono como el texto sí / no false
opacity Opacidad 0 a 1 1
checkable Se puede mantener presionado sí / no false
checked Presionado (si se puede mantener) sí / no false
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
clicked Al hacer clic —

Usar desde Rust: text (SharedString), enabled (bool), checked (bool).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto —
placeholder-text Texto de ayuda texto —
input-type Tipo de entrada opción: text, password, number, decimal text
read-only Solo lectura sí / no false
font-size Tamaño de letra longitud (px) —
horizontal-alignment Alineación del texto opción: left, center, right left
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
accepted Al presionar Enter text (SharedString)
edited Al cambiar el texto text (SharedString)

Usar desde Rust: text (SharedString).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto (varias líneas) —
placeholder-text Texto de ayuda texto —
wrap Ajuste de línea opción: word-wrap, no-wrap word-wrap
read-only Solo lectura sí / no false
font-size Tamaño de letra longitud (px) —
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
edited Al cambiar el texto text (SharedString)

Usar desde Rust: text (SharedString).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto —
checked Marcada sí / no false
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
toggled Al marcar o desmarcar —

Usar desde Rust: checked (bool).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
text Texto texto —
checked Encendido sí / no false
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
toggled Al encender o apagar —

Usar desde Rust: checked (bool).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
value Valor número —
minimum Mínimo número 0
maximum Máximo número 100
step Paso número 1
orientation Orientación opción: horizontal, vertical horizontal
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
changed Al mover value (f32)
released Al soltar value (f32)

Usar desde Rust: value (f32).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
value Valor número entero —
minimum Mínimo número entero 0
maximum Máximo número entero 100
step-size Paso (flechas) número entero 1
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
edited Al cambiar el valor value (i32)

Usar desde Rust: value (i32).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
model Opciones lista de textos —
current-index Índice seleccionado número entero 0
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
selected Al elegir una opción value (SharedString)

Usar desde Rust: current-index (i32), current-value (SharedString).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
progress Progreso 0 a 1 —
indeterminate Indeterminado (animado) sí / no false
opacity Opacidad 0 a 1 1
visible Visible sí / no true

Usar desde Rust: progress (f32).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
source Archivo imagen —
image-fit Ajuste opción: fill, contain, cover, preserve fill
colorize Colorear (íconos) color —
image-rendering Escalado opción: smooth, pixelated smooth
opacity Opacidad 0 a 1 1
visible Visible sí / no true
Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
indeterminate Girando sin parar sí / no false
progress Progreso 0 a 1 —
opacity Opacidad 0 a 1 1
visible Visible sí / no true

Usar desde Rust: progress (f32).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
kind Tipo opción: ok, cancel, apply, close, reset, help, yes, no, abort, retry, ignore ok
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
clicked Al hacer clic —

Usar desde Rust: enabled (bool).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
model Elementos elementos de lista —
current-item Elemento seleccionado (-1 = ninguno) número entero -1
opacity Opacidad 0 a 1 1
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
current-item-changed Al cambiar la selección index (i32)

Usar desde Rust: current-item (i32).

Contenedor: los controles de adentro se ubican con posición fija (X, Y).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
background Fondo color —
border-radius Radio de esquinas longitud (px) 0px
border-width Grosor del borde longitud (px) 0px
border-color Color del borde color —
drop-shadow-color Sombra: color color —
drop-shadow-blur Sombra: desenfoque longitud (px) 0px
drop-shadow-offset-x Sombra: desplazamiento X longitud (px) 0px
drop-shadow-offset-y Sombra: desplazamiento Y longitud (px) 0px
opacity Opacidad 0 a 1 1
clip Recortar el contenido sí / no false
visible Visible sí / no true

Layout automático: acomoda solo a los controles de adentro.

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
padding Margen interior longitud (px) 8px
spacing Separación longitud (px) 8px
alignment Distribución opción: stretch, start, center, end, space-between, space-around, space-evenly stretch
visible Visible sí / no true

Layout automático: acomoda solo a los controles de adentro.

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
padding Margen interior longitud (px) 8px
spacing Separación longitud (px) 8px
alignment Distribución opción: stretch, start, center, end, space-between, space-around, space-evenly stretch
visible Visible sí / no true

Layout automático: acomoda solo a los controles de adentro.

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
padding Margen interior longitud (px) 8px
spacing Separación longitud (px) 8px
visible Visible sí / no true
Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
title Título texto —
content-padding Margen del contenido longitud (px) 0px
enabled Habilitado sí / no true
visible Visible sí / no true
Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
current-index Pestaña inicial (0 = primera) número entero 0
visible Visible sí / no true

Usar desde Rust: current-index (i32).

Contenedor: los controles de adentro se ubican con posición fija (X, Y).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
content-width Ancho del contenido longitud (px) —
content-height Alto del contenido longitud (px) —
visible Visible sí / no true
Evento En el panel Recibe
scrolled Al desplazarse —

Contenedor: los controles de adentro se ubican con posición fija (X, Y).

Propiedad En el panel Valor Por defecto
x X longitud (px) —
y Y longitud (px) —
width Ancho longitud (px) —
height Alto longitud (px) —
mouse-cursor Cursor opción: default, pointer, text, move, crosshair, grab, grabbing, help, wait, progress, not-allowed, copy, ew-resize, ns-resize default
enabled Habilitado sí / no true
visible Visible sí / no true
Evento En el panel Recibe
clicked Al hacer clic —
double-clicked Al hacer doble clic —
moved Al mover el mouse con el botón presionado —

No se ve en la ventana: el diseñador lo muestra en la bandeja Componentes, debajo del lienzo.

Propiedad En el panel Valor Por defecto
interval Cada cuánto duración (ms) 0ms
running En marcha sí / no true
Evento En el panel Recibe
triggered Al cumplirse el intervalo —

Usar desde Rust: running (bool).