Slider2D:
Filter:
Classes | GUI > Views

Slider2D : QAbstractStepValue : AbstractStepValue : View : QObject : Object

A view with a handle movable in two dimensions.
Source: QSlider2D.sc
Subclasses: QSlider2D

Description

A view that allows setting two numerical values represented by the horizontal and vertical position of a handle movable in two dimensions.

The values are always within the range between 0 and 1. Scaling the output and input values to your needs can easily be achieved by using a ControlSpec with its -map and -unmap methods.

The -step variable determines the amount by which the values will change when the handle is controlled using the keyboard. By default, holding down the Shift, Ctrl, or Alt key will multiply this amount by 100, 10, or 0.1 respectively, though you can customize this by setting -shift_scale, -ctrl_scale, or -alt_scale.

Drag and drop gives and accepts a Point of which the two coordinates represent the two values of the Slider2D.

Class Methods

Inherited class methods

Undocumented class methods

Slider2D.new(parent, bounds)

Slider2D.qtClass

Instance Methods

Data

.x

.x = aFloat

The value represented by the horizontal position of the handle. It will always be clipped to the range between 0 and 1.

Arguments:

aFloat

A Float.

.y

.y = aFloat

The value represented by the vertical position of the handle. It will always be clipped to the range between 0 and 1.

Arguments:

aFloat

A Float.

.activex = aFloat

Sets -x and triggers the -action.

.activey = aFloat

Sets -y and triggers the -action.

.setXY(x, y)

Sets -x and -y to the two arguments.

.setXYActive(x, y)

Sets -x and -y to the two arguments, and triggers the -action.

.incrementX(factor: 1.0)

Increments -x by -step multiplied by factor.

.decrementX(factor: 1.0)

Decrements -x by -step multiplied by factor.

.incrementY(factor: 1.0)

Increments -y by -step multiplied by factor.

.decrementY(factor: 1.0)

Decrements -y by -step multiplied by factor.

Appearance

.knobColor

.knobColor = color

The color of the handle.

Arguments:

color

A Color.

Interaction

.step

.step = aFloat

From superclass: AbstractStepValue

The amount by which -x or -y will change when incremented or decremented, either by calling relevant methods, or when related keys are pressed.

Arguments:

aFloat

A Float.

.pixelStepX

The absolute amount by which -x would change if the handle moved horizontally by one pixel.

Returns:

A Float.

.pixelStepY

The absolute amount by which -y would change if the handle moved vertically 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 values 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 values 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 values 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 changes the position or size of the handle.

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

From superclass: View

Implements the default effects of key presses as follows:

KeyEffect
rx_(1.rand), y_(1.rand), and triggers action
nx_(0), y_(0), and triggers action
xx_(1), y_(1), and triggers action
cx_(0.5), y_(0.5), and triggers action
up arrowincrementY
down arrowdecrementY
right arrowincrementX
left arrowdecrementX

Drag and drop

.defaultGetDrag

Returns:

A Point of which the x and y coordinates are set to -x and -y, respectively.

.defaultCanReceiveDrag

Returns:

True if the current drag data is a Point.

.defaultReceiveDrag

Sets -x and -y to the two coordinates of the Point stored as the current drag data, respectively, and triggers the -action.

Inherited instance methods

Undocumented instance methods

.background

.background = color

.randomize

Examples

Drag an drop Points

Shape a Sound