QJoystickPad#
- class QInstrument.widgets.QJoystickPad.QJoystickPad(*args, fullscale=None, stepFraction=0.25, holdThreshold=300, **kwargs)[source]#
Bases:
QWidgetQJoystick with four directional step buttons.
Arranges a
QJoystickin the center of a 3×3 grid with a triangular step button on each side. The central joystick works normally. Each step button, when pressed, emitspositionChangedonce atstepFractionof the axis full-scale; releasing the button emits zero velocity.Signals#
- positionChanged(numpy.ndarray)
Forwarded from the embedded joystick, and also emitted by the step buttons. Carries a two-element
[vx, vy]array in the same output range as the joystick.
Properties#
- stepFractionfloat
Fraction of full-scale used by the step buttons. Range
(0, 1], default 0.25. Settable via stylesheet:qproperty-stepFraction: 0.5;- padColorQtGui.QColor
Forwarded to the embedded joystick and the step buttons. Settable via stylesheet:
qproperty-padColor: #rrggbb;- knobColorQtGui.QColor
Forwarded to the embedded joystick. Settable via stylesheet:
qproperty-knobColor: #rrggbb;
- resizeEvent(event)[source]#
Centre a square sub-region by adjusting layout margins.
When the allocated rectangle is not square — which can happen when
hasHeightForWidth()is not propagated correctly through deeply nested layouts — this pads out the shorter axis so the inner grid always operates in a square region.- Return type:
- minimumSizeHint()[source]#
Return the minimum functional size with a 1:1 aspect ratio.
Two button widths plus a minimum joystick diameter of 60 px.
- Return type:
QSize
- setStepFraction(value)[source]#
Set the step-button velocity fraction.
- Parameters:
value (float) – Fraction of full-scale in the range
(0, 1].- Return type:
- setHoldThreshold(value)[source]#
Set the press duration that distinguishes a click from a hold.
- Parameters:
value (int) – Threshold in milliseconds. A press shorter than this emits
stepped; a press longer than this starts continuous velocity motion viapositionChanged.- Return type:
- padColor = 'QColor'#
- setPadColor(color)[source]#
Set the pad and step-button color.
- Parameters:
color (QtGui.QColor) – Base color forwarded to the joystick pad and all four step buttons.
- Return type:
- knobColor = 'QColor'#
- setKnobColor(color)[source]#
Set the joystick knob color.
- Parameters:
color (QtGui.QColor) – Base color forwarded to the embedded joystick knob.
- Return type: