Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ACG::QtWidgets::QtWheel Class Reference
Inheritance diagram for ACG::QtWidgets::QtWheel:

Public Types

enum  Orientation { Horizontal, Vertical }
 Orientation of the widget.
 

Signals

void angleChangedTo (double _angle)
 
void angleChangedBy (double _angle)
 
void gearUp ()
 
void gearDown ()
 Like gearUp() but the value of gear() halves.
 
void hideWheel ()
 Emitted when the wheel will be hidden by the context menu.
 

Public Member Functions

 QtWheel (QWidget *_parent=0, const char *_name=0, Orientation _orientation=Horizontal)
 Constructor.
 
virtual ~QtWheel ()
 Destructor.
 
int ticks () const
 get number of ticks on the wheel
 
void setTicks (int _number)
 set _number of ticks on the wheel (default: 36)
 
double angle () const
 get current angle of the wheel (radiants, unbounded, cf. clip())
 
void setAngle (double _angle)
 set current angle of the wheel (radiants, unbounded, cf. clip())
 
double diffAngle () const
 
bool marker () const
 Are there markers on the wheel?
 
void setMarker (bool _b)
 enable/disable markers on the wheel
 
Orientation orientation () const
 get orientation
 
void setOrientation (Orientation _orientation)
 set orientation
 
bool draggingWheel () const
 Is the user currently dragging the wheel whith the mouse?
 
void setTracking (bool _b)
 
bool tracking () const
 Is tracking on?
 
void setGear (double _g)
 
double gear () const
 How fast does angle() change when the wheel is turned? (see above)
 
virtual QSizePolicy sizePolicy () const
 reimplemented
 
virtual QSize sizeHint () const
 reimplemented
 

Static Public Member Functions

static double clip (double _angle)
 
static double deg (double _angle)
 maps _angle from radiants to degrees (works also for clip()ped angles)
 

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *)
 reimplemented
 
virtual void mouseReleaseEvent (QMouseEvent *)
 reimplemented
 
virtual void mouseMoveEvent (QMouseEvent *)
 reimplemented
 
virtual void mouseDoubleClickEvent (QMouseEvent *)
 reimplemented
 
virtual void keyPressEvent (QKeyEvent *)
 reimplemented
 
virtual void keyReleaseEvent (QKeyEvent *)
 reimplemented
 
virtual void resizeEvent (QResizeEvent *)
 reimplemented
 
virtual void paintEvent (QPaintEvent *)
 reimplemented More...
 
virtual void drawContents (QPainter *)
 reimplemented
 
virtual void redrawPixmap ()
 draw wheel to pixmap (double buffering)
 

Private Slots

void slotCustomContextMenuRequested (const QPoint &pos)
 

Private Member Functions

 QtWheel (const QtWheel &)
 Copy constructor. Never used!
 
QtWheeloperator= (const QtWheel &)
 Assignment operator. Never used!
 
double turn (const QPoint &_pos)
 
void updateMenu ()
 updates the ticks of the menu
 
void shrinkRect (QRect &, int, int)
 expands a rectangle in x/y direction
 

Private Attributes

double angle_
 current angle of the wheel
 
double lastAngle_
 last angle, depends on tracking_
 
int size_
 size of wheel in pixels
 
double gear_
 speed of revolution
 
int gearShift_
 click-shifted gear by 2^gearShift_
 
Orientation orientation_
 orientation of the widget
 
int ticks_
 number of ticks on the wheel
 
bool marker_
 should ticks be marked by colors?
 
QPoint pos_
 recent mouse position
 
bool dragging_
 currently dragging the slider?
 
bool tracking_
 tracking on?
 
QPalette palette_
 color group
 
QPixmap pixmap_
 pixmap of the wheel
 

Detailed Description

Definition at line 107 of file QtWheel.hh.

Member Function Documentation

void ACG::QtWidgets::QtWheel::angleChangedBy ( double  _angle)
signal

The angle chaned by the relative _angle (cf. clip()).

Note: Do not use this signal together with angleChangedBy()! The reason for this is that you cannot be sure in which order the you get the signals!

If you need both values the angle and the relative difference then use this signal and angle() or angleChangedTo() and diffAngle() respectively!

void ACG::QtWidgets::QtWheel::angleChangedTo ( double  _angle)
signal

The angle changed to the absolute _angle (cf. clip()). Note: Do not use together with angleChangedBy() (see there)!

double ACG::QtWidgets::QtWheel::clip ( double  _angle)
static

Clips _angle to range [0,2pi[. All angle()s provided by this widget are unbounded in a sense that a full turn of the wheel is 2pi not 0. As a consequence two full turns are 4pi, etc.

This methods clips the angle again [0,2pi[

See also
deg()

Definition at line 443 of file QtWheel.cc.

double ACG::QtWidgets::QtWheel::diffAngle ( ) const
inline

Get difference angle. You may call this method from a slot connected to angleChangedTo() and obtain the difference angle (equal to the argument to angleChangedBy()).

Definition at line 150 of file QtWheel.hh.

void ACG::QtWidgets::QtWheel::gearUp ( )
signal

The gear() has been "shifted" by double clicking the widget. Up-shifting will double the value of gear(). The signal is emitted after gear() has been changed.

void ACG::QtWidgets::QtWheel::paintEvent ( QPaintEvent *  _e)
protectedvirtual

reimplemented

Todo:
: bitBlt(this,r.left(),r.top(),pixmap_);

Definition at line 283 of file QtWheel.cc.

void ACG::QtWidgets::QtWheel::setGear ( double  _g)
inline

How fast does angle() changed when the wheel is turned? The default setting is 1.0. Then angle() will be changed by pi (180 degrees) when dragging the wheel from one end of the widget to the other. In general this angular difference will be multiplied by gear(), i.e. for values >1,0 the angle changes faster.

Definition at line 186 of file QtWheel.hh.

void ACG::QtWidgets::QtWheel::setTracking ( bool  _b)
inline

Enables wheel tracking (default: true)

If tracking is enabled, then the QtWheel emits signals whenever the it is dragged. Otherwise signals are emitted only when a dragging process is finished.

Definition at line 175 of file QtWheel.hh.


The documentation for this class was generated from the following files: