用於通過沿軌道滑動 2 手柄來選擇值範圍。 更多...
| import 語句: | import QtQuick.Controls 2.2 |
| Since: | Qt 5.7 |
| 繼承: | Control |
RangeSlider is used to select a range specified by two values, by sliding each handle along a track.
在以下範例中,自定義 from and to values are set, and the initial positions of the first and second handles are set:
RangeSlider {
from: 1
to: 100
first.value: 25
second.value: 75
}
In order to perform an action when the value for a particular handle changes, use the following syntax:
first.onValueChanged: console.log("first.value changed to " + first.value)
The
first.position
and
second.position
properties are expressed as fractions of the control's size, in the range
0.0 - 1.0
。
first.visualPosition
and
second.visualPosition
properties are the same, except that they are reversed in a
right-to-left
application. The
visualPosition
is useful for positioning the handles when styling
RangeSlider
. In the example above,
first.visualPosition
將是
0.24
in a left-to-right application, and
0.76
in a right-to-left application.
另請參閱 Customizing RangeSlider and 輸入控件 .
|
first group |
|---|
|
first.handle : Item |
| 特性 | 描述 |
|---|---|
| 值 |
This property holds the value of the first handle in the range
from
-
to
.
若 from 大於 to , the value of the first handle must be greater than the second, and vice versa.
默認值為
|
| handle | This property holds the first handle item. |
| visualPosition |
This property holds the visual position of the first handle.
The position is expressed as a fraction of the control's size, in the range
|
| 位置 |
This property holds the logical position of the first handle.
The position is expressed as a fraction of the control's size, in the range
|
| pressed | This property holds whether the first handle is pressed. |
| hovered | This property holds whether the first handle is hovered. This property was introduced in QtQuick .Controls 2.1. |
另請參閱 first.increase() and first.decrease() .
This property holds the starting value for the range. The default value is
0.0
.
另請參閱 to , first.value ,和 second.value .
This property holds whether the slider provides live updates for the first.value and second.value properties while the respective handles are dragged.
默認值為
true
.
This QML property was introduced in QtQuick.Controls 2.2 (Qt 5.9).
另請參閱 first.value and second.value .
This property holds the orientation.
可能的值:
| 常量 | 描述 |
|---|---|
Qt.Horizontal
|
Horizontal (default) |
Qt.Vertical
|
Vertical |
|
second group |
|---|
|
second.handle : Item |
| 特性 | 描述 |
|---|---|
| 值 |
This property holds the value of the second handle in the range
from
-
to
.
若 from 大於 to , the value of the first handle must be greater than the second, and vice versa.
默認值為
|
| handle | This property holds the second handle item. |
| visualPosition |
This property holds the visual position of the second handle.
The position is expressed as a fraction of the control's size, in the range
|
| 位置 |
This property holds the logical position of the second handle.
The position is expressed as a fraction of the control's size, in the range
|
| pressed | This property holds whether the second handle is pressed. |
| hovered | This property holds whether the second handle is hovered. This property was introduced in QtQuick .Controls 2.1. |
另請參閱 second.increase() and second.decrease() .
此特性保持捕捉方式。
可能的值:
| 常量 | 描述 |
|---|---|
RangeSlider.NoSnap
|
The slider does not snap (default). |
RangeSlider.SnapAlways
|
The slider snaps while the handle is dragged. |
RangeSlider.SnapOnRelease
|
The slider does not snap while being dragged, but only after the handle is released. |
For visual explanations of the various modes, see the snapMode documentation of Slider .
另請參閱 stepSize .
This property holds the step size. The default value is
0.0
.
另請參閱 snapMode , first.increase() ,和 first.decrease() .
This property holds the end value for the range. The default value is
1.0
.
另請參閱 from , first.value ,和 second.value .
Decreases the value of the handle by
stepSize
,或
0.1
if
stepSize
未定義。
另請參閱 first .
Increases the value of the handle by
stepSize
,或
0.1
if
stepSize
未定義。
另請參閱 first .
Decreases the value of the handle by
stepSize
,或
0.1
if
stepSize
未定義。
另請參閱 second .
Increases the value of the handle by
stepSize
,或
0.1
if
stepSize
未定義。
另請參閱 second .
集 first.value and second.value with the given arguments.
若 to > from and firstValue > secondValue , firstValue will be clamped to secondValue .
若 from > to and secondValue > firstValue , secondValue will be clamped to firstValue .
This function may be necessary to set the first and second values after the control has been completed, as there is a circular dependency between firstValue and secondValue which can cause assigned values to be clamped to each other.
另請參閱 stepSize .