Developer Documentation
ACG::QtWidgets::QtWheel Class Reference
Inheritance diagram for ACG::QtWidgets::QtWheel:

Public Types

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

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

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) More...
 

Protected Member Functions

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

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 More...
 

Private Attributes

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

Detailed Description

Definition at line 101 of file QtWheel.hh.

Member Enumeration Documentation

◆ Orientation

Orientation of the widget.

Definition at line 107 of file QtWheel.hh.

Constructor & Destructor Documentation

◆ QtWheel()

ACG::QtWidgets::QtWheel::QtWheel ( QWidget *  _parent = 0,
const char *  _name = 0,
Orientation  _orientation = Horizontal 
)

Constructor.

Definition at line 77 of file QtWheel.cc.

◆ ~QtWheel()

ACG::QtWidgets::QtWheel::~QtWheel ( )
virtual

Destructor.

Definition at line 106 of file QtWheel.cc.

Member Function Documentation

◆ angle()

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

get current angle of the wheel (radiants, unbounded, cf. clip())

Definition at line 134 of file QtWheel.hh.

◆ angleChangedBy

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!

◆ angleChangedTo

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)!

◆ clip()

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 436 of file QtWheel.cc.

◆ deg()

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

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

Definition at line 440 of file QtWheel.cc.

◆ diffAngle()

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 144 of file QtWheel.hh.

◆ draggingWheel()

bool ACG::QtWidgets::QtWheel::draggingWheel ( ) const
inline

Is the user currently dragging the wheel whith the mouse?

Definition at line 161 of file QtWheel.hh.

◆ drawContents()

virtual void ACG::QtWidgets::QtWheel::drawContents ( QPainter *  )
inlineprotectedvirtual

reimplemented

Definition at line 249 of file QtWheel.hh.

◆ gear()

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

How fast does angle() change when the wheel is turned? (see above)

Definition at line 182 of file QtWheel.hh.

◆ gearUp

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.

◆ keyPressEvent()

void ACG::QtWidgets::QtWheel::keyPressEvent ( QKeyEvent *  _e)
protectedvirtual

reimplemented

Definition at line 208 of file QtWheel.cc.

◆ keyReleaseEvent()

void ACG::QtWidgets::QtWheel::keyReleaseEvent ( QKeyEvent *  _e)
protectedvirtual

reimplemented

Definition at line 252 of file QtWheel.cc.

◆ marker()

bool ACG::QtWidgets::QtWheel::marker ( ) const
inline

Are there markers on the wheel?

Definition at line 147 of file QtWheel.hh.

◆ mouseDoubleClickEvent()

void ACG::QtWidgets::QtWheel::mouseDoubleClickEvent ( QMouseEvent *  _e)
protectedvirtual

reimplemented

Definition at line 171 of file QtWheel.cc.

◆ mouseMoveEvent()

void ACG::QtWidgets::QtWheel::mouseMoveEvent ( QMouseEvent *  _e)
protectedvirtual

reimplemented

Definition at line 133 of file QtWheel.cc.

◆ mousePressEvent()

void ACG::QtWidgets::QtWheel::mousePressEvent ( QMouseEvent *  _e)
protectedvirtual

reimplemented

Definition at line 111 of file QtWheel.cc.

◆ mouseReleaseEvent()

void ACG::QtWidgets::QtWheel::mouseReleaseEvent ( QMouseEvent *  _e)
protectedvirtual

reimplemented

Definition at line 120 of file QtWheel.cc.

◆ paintEvent()

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

reimplemented

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

Definition at line 276 of file QtWheel.cc.

◆ redrawPixmap()

void ACG::QtWidgets::QtWheel::redrawPixmap ( )
protectedvirtual

draw wheel to pixmap (double buffering)

Definition at line 292 of file QtWheel.cc.

◆ resizeEvent()

void ACG::QtWidgets::QtWheel::resizeEvent ( QResizeEvent *  _e)
protectedvirtual

reimplemented

Definition at line 271 of file QtWheel.cc.

◆ setAngle()

void ACG::QtWidgets::QtWheel::setAngle ( double  _angle)
inline

set current angle of the wheel (radiants, unbounded, cf. clip())

Definition at line 136 of file QtWheel.hh.

◆ setGear()

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 180 of file QtWheel.hh.

◆ setMarker()

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

enable/disable markers on the wheel

Definition at line 149 of file QtWheel.hh.

◆ setOrientation()

void ACG::QtWidgets::QtWheel::setOrientation ( Orientation  _orientation)
inline

set orientation

Definition at line 156 of file QtWheel.hh.

◆ setTicks()

void ACG::QtWidgets::QtWheel::setTicks ( int  _number)
inline

set _number of ticks on the wheel (default: 36)

Definition at line 129 of file QtWheel.hh.

◆ setTracking()

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 169 of file QtWheel.hh.

◆ shrinkRect()

void ACG::QtWidgets::QtWheel::shrinkRect ( QRect &  _rect,
int  _dx,
int  _dy 
)
private

expands a rectangle in x/y direction

Definition at line 404 of file QtWheel.cc.

◆ sizeHint()

QSize ACG::QtWidgets::QtWheel::sizeHint ( ) const
virtual

reimplemented

Definition at line 425 of file QtWheel.cc.

◆ sizePolicy()

QSizePolicy ACG::QtWidgets::QtWheel::sizePolicy ( ) const
virtual

reimplemented

Definition at line 413 of file QtWheel.cc.

◆ slotCustomContextMenuRequested

void ACG::QtWidgets::QtWheel::slotCustomContextMenuRequested ( const QPoint &  pos)
privateslot

Definition at line 446 of file QtWheel.cc.

◆ ticks()

int ACG::QtWidgets::QtWheel::ticks ( ) const
inline

get number of ticks on the wheel

Definition at line 127 of file QtWheel.hh.

◆ tracking()

bool ACG::QtWidgets::QtWheel::tracking ( ) const
inline

Is tracking on?

Definition at line 171 of file QtWheel.hh.

◆ turn()

double ACG::QtWidgets::QtWheel::turn ( const QPoint &  _pos)
private

Definition at line 149 of file QtWheel.cc.

Member Data Documentation

◆ angle_

double ACG::QtWidgets::QtWheel::angle_
private

current angle of the wheel

Definition at line 270 of file QtWheel.hh.

◆ dragging_

bool ACG::QtWidgets::QtWheel::dragging_
private

currently dragging the slider?

Definition at line 283 of file QtWheel.hh.

◆ gear_

double ACG::QtWidgets::QtWheel::gear_
private

speed of revolution

Definition at line 274 of file QtWheel.hh.

◆ gearShift_

int ACG::QtWidgets::QtWheel::gearShift_
private

click-shifted gear by 2^gearShift_

Definition at line 275 of file QtWheel.hh.

◆ lastAngle_

double ACG::QtWidgets::QtWheel::lastAngle_
private

last angle, depends on tracking_

Definition at line 271 of file QtWheel.hh.

◆ marker_

bool ACG::QtWidgets::QtWheel::marker_
private

should ticks be marked by colors?

Definition at line 280 of file QtWheel.hh.

◆ orientation_

Orientation ACG::QtWidgets::QtWheel::orientation_
private

orientation of the widget

Definition at line 277 of file QtWheel.hh.

◆ palette_

QPalette ACG::QtWidgets::QtWheel::palette_
private

color group

Definition at line 286 of file QtWheel.hh.

◆ pixmap_

QPixmap ACG::QtWidgets::QtWheel::pixmap_
private

pixmap of the wheel

Definition at line 287 of file QtWheel.hh.

◆ pos_

QPoint ACG::QtWidgets::QtWheel::pos_
private

recent mouse position

Definition at line 282 of file QtWheel.hh.

◆ size_

int ACG::QtWidgets::QtWheel::size_
private

size of wheel in pixels

Definition at line 272 of file QtWheel.hh.

◆ ticks_

int ACG::QtWidgets::QtWheel::ticks_
private

number of ticks on the wheel

Definition at line 279 of file QtWheel.hh.

◆ tracking_

bool ACG::QtWidgets::QtWheel::tracking_
private

tracking on?

Definition at line 284 of file QtWheel.hh.


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