MultiSliderView:
Filter:
Classes | GUI > Views

MultiSliderView : View : QObject : Object

A view displaying an array of sliders
Subclasses: QMultiSliderView

Description

MultiSliderView displays a collection of values, each represented by the position of one of the sliders placed side by side.

When clicking into the view, the value of the slider under the mouse pointer will be set. Whenever the mouse is moved with a mouse button pressed, the slider currently under the mouse pointer will be adjusted.

The last slider modified is considered to be the current one, i.e. the -index method will return its index, and -currentValue relates to its value.

The current slider is also considered to be the selected one. Selection can be extended to more than one slider by modifying -selectionSize. Whenever a different slider becomes the current one, the selection size shrinks back to 1. Note that the selection will only be visually indicated if -showIndex is true.

Class Methods

MultiSliderView.new(parent, bounds)

From superclass: View

A new MultiSliderView is created empty, without any columns. -size or -value has to be set in order to create some columns.

So if you want a specific number of sliders, then it is best to specify the -size and set -elasticMode to 1. Then you will get a MultiSliderView which distributes -size amount of sliders over bounds.width, where the slider widths are at maximum -indexThumbSize (default 12) and the -gap is adjusted accordingly.

Inherited class methods

Undocumented class methods

MultiSliderView.qtClass

Instance Methods

Data

.size

.size = int

The amount of sliders.

When setting -size, if the new amount is larger then the current, new sliders will be added with the value of 0. In the opposite case, the value of sliders up to the new amount will be preserved, and the rest of the sliders will be removed.

NOTE: In Cocoa GUI:

Changing -size after the view has been drawn or after the -value array has been set will lead to unexpected results. Instead, you should change the -value, if you need to change the contents of the view.

Arguments:

int

An Integer.

.value

.value = array

Sets the values of the sliders to those of the elements of the argument.

NOTE: If the amount of elements in the argument does not match -size, then makes -size match before applying the new values.

Arguments:

array

An array of Floats.

.valueAction = val

Sets -value and triggers -action.

.reference

.reference = array

The reference values in relation to which the values will be visually represented. The default for each slider is 0.

Arguments:

array

An array of Floats.

.index

.index = anInt

The index of the current slider, i.e. the first one in the selection.

Arguments:

anInt

An Integer.

.selectionSize

.selectionSize = anInt

The amount of sliders in the selection (starting at -index).

.currentvalue

.currentvalue = aFloat

The value of the slider at -index

Arguments:

aFloat

A Float.

Display

.indexIsHorizontal

.indexIsHorizontal = bool

The orientation of the view: if true, the sliders are displayed in a horizontal order, otherwise in a vertical order.

Arguments:

bool

A Boolean.

.elasticMode

.elasticMode = int

If enabled (set to 1), the sliders from -startIndex to the last one will be distributed so as to occupy the whole area of the view. The -gap variable will be ignored. The size of each slider in the direction of index will be maximally -indexThumbSize, or smaller in order for all the sliders to fit into the view.

Arguments:

int

0 (disabled) or 1 (enabled).

.gap

.gap = anInt

The gap between the sliders in pixels when -elasticMode is disabled.

Arguments:

anInt

An Integer.

.indexThumbSize

.indexThumbSize = float

The size of the sliders in the direction of index in pixels . If -elasticMode is enabled, this will be the maximum size, but the actual size might be smaller in order for all the sliders to fit into the view.

Arguments:

float

An Integer.

.valueThumbSize

.valueThumbSize = float

The size of the slider handles in the direction of value in pixels (if drawn).

Arguments:

float

An Integer.

.thumbSize = float

Sets both -indexThumbSize and -valueThumbSize to the argument.

.startIndex = anInt

The index of the slider displayed at the left or top edge of the view (depending on whether -indexIsHorizontal is true or false, respectively). Sliders with lower index than this will not be visible.

Arguments:

anInt

An Integer.

Appearance

.showIndex = aBool

Whether the slider selection is visually indicated.

Arguments:

aBool

A Boolean.

.drawRects

.drawRects = bool

Whether to draw the sliders.

Arguments:

bool

A Boolean.

.drawLines

.drawLines = bool

Whether to draw a line connecting the points that represent the values of the sliders, and a line connecting the points that represent the references.

Arguments:

bool

A Boolean.

.isFilled = aBool

If true, the sliders will have their area between the -reference and the -value colored, and the area bounded by the lines connecting the reference and the value points will be colored as well.

Arguments:

aBool

A Boolean.

.strokeColor

.strokeColor = color

The color used to draw the lines described in -drawLines.

Arguments:

color

A Color.

.fillColor

.fillColor = color

The color used to visualize the areas described in -isFilled.

Arguments:

color

A Color.

.colors_(colorStroke, colorFill)

Sets -strokeColor and -fillColor to the two arguments, respectively.

Interaction

.editable

.editable = aBool

Whether the values can be edited using mouse or keyboard.

Arguments:

aBool

A Boolean.

.readOnly

.readOnly = bool

The opposite if -editable.

Arguments:

bool

A Boolean.

.step

.step = val

If the argument is larger than 0, makes the MultiSliderView keep the values quantized to the nearest multiple of the argument.

Actions

.action

.action = func

From superclass: View

The action object evaluated whenever the user changes the value of a slider.

.metaAction

.metaAction = func

The action object evaluated whenever the user changes the value of a slider while the Ctrl key is pressed.

.defaultKeyDownAction(char, mod, uni, keycode, key)

Implements the default effects of key presses as follows:

KeyEffect
up arrowincrement -currentValue by -step
down arrowdecrement -currentValue by -step
right arrowincrement -index by 1
left arrowdecrement -index by 1

Drag and drop

.defaultGetDrag

Returns:

a) If -selectionSize is 0, returns -value.

b) If -selectionSize > 1, returns an Array with the values at the indexes in the selection.

If -reference is not nil, returns an Array containing (a) or (b), and an Array of the corresponding reference values: [[values], [references]].

.defaultCanReceiveDrag

Returns:

True for any drag data, but the data should either be an Array of values ( [values] ), or an Array containg an Array of values and an Array of corresponding reference values ( [[values], [references]] ).

.defaultReceiveDrag(data)

If the drag data is in one of the acceptable forms (see -defaultCanReceiveDrag above), sets -value (and -reference) using that data.

Inherited instance methods

Undocumented instance methods

.doMetaAction

.xOffset

.xOffset = int

Examples

Basic Examples

Looks like a candlestick graph:

Interactive Example

A walk through all the graphic options:

Display a Sound File

Use as a Sequencer