JoystickControlWidget Class Reference

Provides a simple joystick control. More...

#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/JoystickControlWidget.h>

+ Inheritance diagram for JoystickControlWidget:

Public Slots

int getSteps ()
 Returns the steps of the control. More...
 
void setNibble (QPointF pos)
 Sets the nibble to pos. More...
 
void setSteps (int stepCount)
 Sets the steps of the control. More...
 

Signals

void changed (QPointF, double)
 Passes the position and angle of the control in polar coordinates (-pi,pi]. More...
 
void positionChanged (QPointF)
 Passes the position of the control. More...
 
void pressed ()
 Emitted when the nibble was pressed. More...
 
void released ()
 Emitted when the nibble was released. More...
 
void rotationChanged (double)
 Passes the angle of the control in polar coordinates (-pi,pi]. More...
 

Public Member Functions

QPointF getPosition () const
 Returns the position of the nibble. More...
 
double getRotation () const
 f the control in polar coordinates (-pi,pi]. More...
 
 JoystickControlWidget (bool useQuadrant3and4=true, QWidget *parent=0)
 

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 

Detailed Description

Provides a simple joystick control.

The widget emits signals when the control is moved.

The signal

passes the nibble's current position. The position is in the unit circle. The x-axis is horizontal and increases to the right. The y-axis is vertical and increases upwards.

The signal

passes the position vectors rotation in polar coordinates (-pi,pi]. The up position is 0. The down position is pi. The Quadrants 1 and 4 have positive value.

If the constructor is called with useQuadrant3and4==true the control is the whole unit circle. If the constructor is called with useQuadrant3and4==false the control is the unit circle's upper semicircle. (y>=0)

Possible positions can be influenced with

setSteps(int steps);
  • steps>0 : only position vectors with a length from {n/steps | n in {0,1,...,steps} are valid. The nibble snaps to a valid position.
  • steps<=0: all positions in the unit circle are valid.
Left: A widget with 2 steps using the whole unit circle. Right: A widget using the unit circle's upper semi circle.

Definition at line 124 of file JoystickControlWidget.h.

Constructor & Destructor Documentation

◆ JoystickControlWidget()

JoystickControlWidget ( bool  useQuadrant3and4 = true,
QWidget *  parent = 0 
)
explicit

Definition at line 68 of file JoystickControlWidget.cpp.

Member Function Documentation

◆ changed

void changed ( QPointF  ,
double   
)
signal

Passes the position and angle of the control in polar coordinates (-pi,pi].

+ Here is the caller graph for this function:

◆ getPosition()

QPointF getPosition ( ) const

Returns the position of the nibble.

The position is in a circle with the radius 1 around (0;0)

Returns
The position of the nibble.

Definition at line 112 of file JoystickControlWidget.cpp.

+ Here is the caller graph for this function:

◆ getRotation()

double getRotation ( ) const

f the control in polar coordinates (-pi,pi].

The top position is 0. The bottom pos

Returns the angle oition is pi. The Quadrants 1 and 4 have positive value.

Returns
The angle of the control in polar coordinates (-pi,pi].

Definition at line 117 of file JoystickControlWidget.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSteps

int getSteps ( )
slot

Returns the steps of the control.

(0=> unlimited steps)

Returns
The steps of the control. (0=> unlimited steps)

Definition at line 224 of file JoystickControlWidget.cpp.

◆ positionChanged

void positionChanged ( QPointF  )
signal

Passes the position of the control.

The position is in a circle with the radius 1 around (0;0)

+ Here is the caller graph for this function:

◆ pressed

void pressed ( )
signal

Emitted when the nibble was pressed.

◆ released

void released ( )
signal

Emitted when the nibble was released.

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 194 of file JoystickControlWidget.cpp.

+ Here is the call graph for this function:

◆ rotationChanged

void rotationChanged ( double  )
signal

Passes the angle of the control in polar coordinates (-pi,pi].

The top position is 0. The bottom position is pi. The Quadrants 1 and 4 have positive value.

+ Here is the caller graph for this function:

◆ setNibble

void setNibble ( QPointF  pos)
slot

Sets the nibble to pos.

(pos will be transformed to be a valid position)

Parameters
posThe new position.

Definition at line 148 of file JoystickControlWidget.cpp.

+ Here is the call graph for this function:

◆ setSteps

void setSteps ( int  stepCount)
slot

Sets the steps of the control.

(0=> unlimited steps)

Parameters
stepCountThe new step count. (values <0 will be used as 0)

Definition at line 219 of file JoystickControlWidget.cpp.


The documentation for this class was generated from the following files:
armarx::JoystickControlWidget::rotationChanged
void rotationChanged(double)
Passes the angle of the control in polar coordinates (-pi,pi].
armarx::JoystickControlWidget::setSteps
void setSteps(int stepCount)
Sets the steps of the control.
Definition: JoystickControlWidget.cpp:219
armarx::JoystickControlWidget::positionChanged
void positionChanged(QPointF)
Passes the position of the control.