Slider:
Filter:
Classes | GUI > Views

Slider : QAbstractStepValue : AbstractStepValue : View : QObject : Object

A view consisting of a sliding handle.
Source: QSlider.sc
Subclasses: MSliderView, QSlider

Description

A view that allows setting a numerical value by means of moving a sliding handle. It can have horizontal or vertical orientation, meaning the direction in which the handle moves.

Class Methods

Slider.new(parent, bounds)

When a new Slider is created, its -orientation is determined by the initial size: if it is wider than high, the orientation will be horizontal, otherwise it will be vertical.

Inherited class methods

Undocumented class methods

Slider.qtClass

Instance Methods

Data

.value

.value = argVal

Numerical value between 0 and 1, represented by the handle position within the groove.

Arguments:

argVal

A Float.

.valueAction = val

Sets -value and triggers -action.

.increment(factor: 1.0)

From superclass: AbstractStepValue

Increments the value by -step multiplied by 'factor'.

Arguments:

factor

Any number.

.decrement(factor: 1.0)

From superclass: AbstractStepValue

Decrements the value by -step multiplied by 'factor'.

Arguments:

factor

Any number.

Appearance

.orientation

.orientation = aSymbol

The orientation of the Slider - the direction in which the handle moves. The default value depends on the size of the view when created.

Arguments:

aSymbol

One of the two Symbols: \horizontal or \vertical.

.thumbSize

.thumbSize = pixels

The size of the handle - its width or height, depending on -orientation.

Arguments:

pixels

An Integer amount of pixels.

.knobColor

.knobColor = color

The color of the handle.

Arguments:

color

A Color.

Interaction

.step

.step = aFloat

The amount by which the value will changed when -increment or -decrement is called, or when related keys are pressed.

Arguments:

aFloat

A Float.

.pixelStep

The absolute amount by which the value would change if the handle moved by one pixel.

Returns:

A Float.

.shift_scale

.shift_scale = aFloat

From superclass: AbstractStepValue

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Shift key is pressed.

Arguments:

aFloat

A Float.

.ctrl_scale

.ctrl_scale = aFloat

From superclass: AbstractStepValue

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Ctrl key is pressed.

Arguments:

aFloat

A Float.

.alt_scale

.alt_scale = aFloat

From superclass: AbstractStepValue

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Alt key is pressed.

Arguments:

aFloat

A Float.

Actions

.action

.action = func

From superclass: View

The action object evaluated whenever the user moves the handle.

.defaultKeyDownAction(char, modifiers, unicode, keycode, key)

Implements the default effects of key presses as follows:

KeyEffect
rvalueAction_(1.0.rand)
nvalueAction_(0)
xvalueAction_(1)
cvalueAction_(0.5)
]increment
[decrement
up arrowincrement
down arrowdecrement
right arrowincrement
left arrowdecrement

Drag and drop

.defaultGetDrag

Returns:

The -value.

.defaultCanReceiveDrag

Returns:

True if the current drag data is a number.

.defaultReceiveDrag

Sets -valueAction to the current drag data.

Inherited instance methods

Undocumented instance methods

.background

.background = color

.initSlider(bounds)

Examples

Show the slider value in a NumberBox

Use a Spec to round and map the output range

Change the stepsize of the slider, selected via a PopUpMenu

Use the slider view to accept key actions

Adding functionality to a view by the method addAction

This is useful for adding things to existing frameworks that have action functions already.

Use Slider for triggering sounds

Change background color of Window