Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Range

Hereda: Control < CanvasItem < Node < Object

Heredado por: EditorSpinSlider, ProgressBar, ScrollBar, Slider, SpinBox, TextureProgressBar

Clase base abstracta para controles que representan un número dentro de un rango.

Descripción

Range es una clase base abstracta para controles que representan un número dentro de un rango, usando un tamaño de step y page configurado. Ver por ejemplo ScrollBar y Slider para ver ejemplos de nodos de nivel superior que usan Range.

Propiedades

bool

allow_greater

false

bool

allow_lesser

false

bool

exp_edit

false

float

max_value

100.0

float

min_value

0.0

float

page

0.0

float

ratio

bool

rounded

false

BitField[SizeFlags]

size_flags_vertical

0 (overrides Control)

float

step

0.01

float

value

0.0

Métodos

void

_value_changed(new_value: float) virtual

void

set_value_no_signal(value: float)

void

share(with: Node)

void

unshare()


Señales

changed() 🔗

Emitida cuando min_value, max_value, page o step cambian.


value_changed(value: float) 🔗

Emitted when value changes. When used on a Slider, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to value_changed, consider using a debouncing Timer to call the function less often.

Note: Unlike signals such as LineEdit.text_changed, value_changed is also emitted when value is set directly via code.


Descripciones de Propiedades

bool allow_greater = false 🔗

  • void set_allow_greater(value: bool)

  • bool is_greater_allowed()

Si es true, value puede ser mayor que max_value.


bool allow_lesser = false 🔗

  • void set_allow_lesser(value: bool)

  • bool is_lesser_allowed()

Si es true, value puede ser menor que min_value.


bool exp_edit = false 🔗

  • void set_exp_ratio(value: bool)

  • bool is_ratio_exp()

Si es true, y min_value es mayor o igual que 0, value se representará exponencialmente en lugar de linealmente.


float max_value = 100.0 🔗

Valor máximo. El rango se limita si value es mayor que max_value.


float min_value = 0.0 🔗

Valor mínimo. El rango se limita si value es menor que min_value.


float page = 0.0 🔗

Tamaño de la página. Usado principalmente para ScrollBar. La longitud del tirador de una ScrollBar es el tamaño de la ScrollBar multiplicado por page sobre la diferencia entre min_value y max_value.


float ratio 🔗

  • void set_as_ratio(value: float)

  • float get_as_ratio()

El valor asignado entre 0 y 1.


bool rounded = false 🔗

  • void set_use_rounded_values(value: bool)

  • bool is_using_rounded_values()

Si es true, value siempre se redondeará al entero más cercano.


float step = 0.01 🔗

If greater than 0.0, value will always be rounded to a multiple of this property's value above min_value. For example, if min_value is 0.1 and step is 0.2, then value is limited to 0.1, 0.3, 0.5, and so on. If rounded is also true, value will first be rounded to a multiple of this property's value, then rounded to the nearest integer.


float value = 0.0 🔗

Range's current value. Changing this property (even via code) will trigger value_changed signal. Use set_value_no_signal() if you want to avoid it.


Descripciones de Métodos

void _value_changed(new_value: float) virtual 🔗

Se llama cuando el valor del Range cambia (siguiendo las mismas condiciones que la señal value_changed).


void set_value_no_signal(value: float) 🔗

Establece el valor actual del Range al value especificado, sin emitir la señal value_changed.


void share(with: Node) 🔗

Vincula dos Ranges entre sí, junto con cualquier rango previamente agrupado con cualquiera de ellos. Cuando cualquiera de las variables miembro de un rango cambia, compartirá el nuevo valor con todos los demás rangos de su grupo.


void unshare() 🔗

Hace que el Range deje de compartir sus variables miembro con cualquier otro.