The SliderWidget JavaScript class. A vertical or horizontal slider. More...
Signals | |
void | valueChanged (float newSliderValue) |
Signal notifying the user that the slider value was modified by the Transform Tool. More... | |
Signals inherited from WidgetBase | |
void | dragStarted (QScriptValue dragContext) |
signal called on mouse down when picking this widget with the Transform tool More... | |
void | drag (QScriptValue dragContext) |
signal called when this widget is dragged with the Transform tool More... | |
void | dragEnded () |
signal called on mouse up after having manipulated this widget with the Transform tool More... | |
Additional Inherited Members | |
Public Slots inherited from WidgetBase | |
Attribute * | data (int index=0) |
The SliderWidget JavaScript class. A vertical or horizontal slider.
Slider widgets provide to the user a vertical or horizontal slider Camera view control. Its handle can be slided and dragged by using the Transform tool. The slider value goes from a user defined minimum value to a user defined maximum value. The user defined values can be specified at the widget construction. The slider can also be translated by having the user pick and drag its frame.
If no attribute is given at the construction of this object, the object will generate one of the proper type.
The following properties are supported by the widget:
Property | Type | Default Value | Description |
---|---|---|---|
data | String | - | The name of the automatically generated double floating point attribute (if none is provided). The value will range from min to max. |
data | Attribute | - | An attribute of double (floating point) type that can be shared with another widget or node. |
length | float | 0.5 | The length of the slider in fields. |
radius | float | 0.03 | The radius of the slider handle in fields. |
continuous | bool | true | When set to false, this option prevents interpolation between steps |
drop_shadow | bool | false | Paint a shadow under the slider. |
horizontal | bool | false | Make the slider appears horizontal. Vertical if false. |
min | float | 0 | Minimum value of the slider. |
max | float | 100 | Maximum value of the slider. |
slider_color | ColorRGBA | white | The colour of the handle of the slider. |
contour_color | ColorRGBA | dark gray | The colour of the circle highlighting the handle of the slider. |
slider_selection_color | ColorRGBA | 125,125,255 | The colour of the handle of the slider when selected. |
frame_color | ColorRGBA | 200,200,200 | The colour of the frame of the slider. |
frame_selection_color | ColorRGBA | 125,125,255 | The colour of the frame of the slider when selected. |
position | Point2d | 0.,0. | Default position of the slider frame bottom left corner. In fields. |
screen_space | bool | false | When set to true, the slider position becomes relative to the screen rather than the scene. |
dynamic_label_data | String | - | [optional] Automatically generated attribute, which can be changed during slider usage. |
label | String | "text" | Label text |
label_color | ColorRGBA | 255, 255, 255 | Label foreground (text) color. |
label_bg_color | ColorRGBA | 0, 0, 0, 128 | Label background color. Accepts transparency values. |
label_font | String | "Arial" | Label font name. |
label_size | float | 10.0 | Label font size, in points. |
label_pos | Point2d | Point2d(0,0) | Label position, in fields. |
label_justify | String | "Left" | Horizontal label text alignment ("Left"/"Center"). |
label_screenspace | bool | true | Forces the label size to remain constant relative to screen. |
label_screenspace_offset | Point2d | Point2d(0,0) | Label position offset, in screen space. |
The following components are used for the slider handle.
Slider Components | Type |
---|---|
attribute | DOUBLE |
drag_manipulator | SLIDER |
painter | SLIDER |
picker | MONO |
local_transformation | TRANSLATION_XYZ |
The following components are used for the slider frame.
Slider frame Components | Type |
---|---|
attribute | POSITION_3D |
drag_manipulator | POSITION_3D |
painter | SLIDER_FRAME |
picker | MULTI |
local_transformation | TRANSLATION_XYZ |
Connect to this scriptWidget valueChanged signal to be notified when a modification has been applied to the widget. In the callback function, transfer the widget value into an action (like modifying a peg attribute value).
The previous example demonstrates how to instantiate a new widget and register it in the Controller global object.
This example shows how to apply a new slider value to a peg.
This example shows how to update the slider widget value when the current frame changes.
|
signal |
Signal notifying the user that the slider value was modified by the Transform Tool.
newSliderValue | the new slider value |