Range
继承: Control
< CanvasItem
< Node
< Object
派生: EditorSpinSlider
, ProgressBar
, ScrollBar
, Slider
, SpinBox
, TextureProgressBar
Abstract base class for controls that represent a number within a range.
描述
Range is an abstract base class for controls that represent a number within a range, using a configured step
and page
size. See e.g. ScrollBar
and Slider
for examples of higher-level nodes using Range.
属性
bool | allow_greater |
bool | allow_lesser |
bool | exp_edit |
float | max_value |
float | min_value |
float | page |
float | ratio |
bool | rounded |
SizeFlags | size_flags_vertical |
float | step |
float | value |
方法
void | _value_changed ( new_value: float ) virtual1 |
void | set_value_no_signal ( value: float ) |
void | share ( with: Node ) |
void | unshare ( ) |
信号
changed ( )
Emitted when min_value
, max_value
, page
, or step
change.
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.
属性说明
bool
allow_greater = false
If true
, value
may be greater than max_value
.
bool
allow_lesser = false
If true
, value
may be less than min_value
.
bool
exp_edit = false
If true
, and min_value
is greater than 0, value
will be represented exponentially rather than linearly.
float
max_value = 100.0
Maximum value. Range is clamped if value
is greater than max_value
.
float
min_value = 0.0
Minimum value. Range is clamped if value
is less than min_value
.
float
page = 0.0
Page size. Used mainly for ScrollBar
. ScrollBar's length is its size multiplied by page
over the difference between min_value
and max_value
.
float
ratio
The value mapped between 0 and 1.
bool
rounded = false
If true
, value
will always be rounded to the nearest integer.
float
step = 0.01
If greater than 0, value
will always be rounded to a multiple of this property's value. 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.
方法说明
void
_value_changed ( new_value: float
) virtual1
Called when the Range's value is changed (following the same conditions as value_changed
).
void
set_value_no_signal ( value: float
)
Sets the Range's current value to the specified value
, without emitting the value_changed
signal.
void
share ( with: Node
)
Binds two Range s together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group.
void
unshare ( )
Stops the Range from sharing its member variables with any other.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。