QWT 7.0.1
Loading...
Searching...
No Matches
Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
QwtAnalogClock Class Reference

An analog clock. More...

#include <qwt_analog_clock.h>

Inheritance diagram for QwtAnalogClock:
QwtDial QwtAbstractSlider QwtAbstractScale

Public Types

enum  Hand { SecondHand , MinuteHand , HourHand , NHands }
 Hand type. More...
 
- Public Types inherited from QwtDial
enum  Shadow { Plain = QFrame::Plain , Raised = QFrame::Raised , Sunken = QFrame::Sunken }
 Frame shadow. More...
 
enum  Mode { RotateNeedle , RotateScale }
 Mode controlling whether the needle or the scale is rotating. More...
 

Public Slots

void setCurrentTime ()
 Set the current time.
 
void setTime (const QTime &)
 Set a time.
 
- Public Slots inherited from QwtAbstractSlider
void setValue (double value)
 Set the slider to the specified value.
 

Public Member Functions

 QwtAnalogClock (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtAnalogClock ()
 Destructor.
 
void setHand (Hand, QwtDialNeedle *)
 Set a clock hand.
 
const QwtDialNeedlehand (Hand) const
 
QwtDialNeedlehand (Hand)
 
- Public Member Functions inherited from QwtDial
 QwtDial (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtDial ()
 Destructor.
 
void setFrameShadow (Shadow)
 Sets the frame shadow value from the frame style.
 
Shadow frameShadow () const
 
void setLineWidth (int)
 Sets the line width of the frame.
 
int lineWidth () const
 
void setMode (Mode)
 Change the mode of the dial.
 
Mode mode () const
 
void setScaleArc (double minArc, double maxArc)
 Change the arc of the scale.
 
void setMinScaleArc (double)
 Set the lower limit for the scale arc.
 
double minScaleArc () const
 
void setMaxScaleArc (double)
 Set the upper limit for the scale arc.
 
double maxScaleArc () const
 
virtual void setOrigin (double)
 Change the origin.
 
double origin () const
 The origin is the angle where scale and needle is relative to.
 
void setNeedle (QwtDialNeedle *)
 Set a needle for the dial.
 
const QwtDialNeedleneedle () const
 
QwtDialNeedleneedle ()
 
QRect boundingRect () const
 
QRect innerRect () const
 
virtual QRect scaleInnerRect () const
 
virtual QSize sizeHint () const QWT_OVERRIDE
 
virtual QSize minimumSizeHint () const QWT_OVERRIDE
 
void setScaleDraw (QwtRoundScaleDraw *)
 Set an individual scale draw.
 
QwtRoundScaleDrawscaleDraw ()
 
const QwtRoundScaleDrawscaleDraw () const
 
- Public Member Functions inherited from QwtAbstractSlider
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtAbstractSlider ()
 Destructor.
 
void setValid (bool)
 Set the value to be valid/invalid.
 
bool isValid () const
 
double value () const
 Returns the current value.
 
void setWrapping (bool)
 If wrapping is true stepping up from upperBound() value will take you to the minimum() value and vice versa.
 
bool wrapping () const
 
void setTotalSteps (uint)
 Set the number of steps.
 
uint totalSteps () const
 
void setSingleSteps (uint)
 Set the number of steps for a single increment.
 
uint singleSteps () const
 
void setPageSteps (uint)
 Set the number of steps for a page increment.
 
uint pageSteps () const
 
void setStepAlignment (bool)
 Enable step alignment.
 
bool stepAlignment () const
 
void setTracking (bool)
 Enables or disables tracking.
 
bool isTracking () const
 
void setReadOnly (bool)
 En/Disable read only mode.
 
bool isReadOnly () const
 In read only mode the slider can't be controlled by mouse or keyboard.
 
void setInvertedControls (bool)
 Invert wheel and key events.
 
bool invertedControls () const
 
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtAbstractScale ()
 Destructor.
 
void setScale (double lowerBound, double upperBound)
 Specify a scale.
 
void setScale (const QwtInterval &)
 Specify a scale.
 
void setScale (const QwtScaleDiv &)
 Specify a scale.
 
const QwtScaleDivscaleDiv () const
 
void setLowerBound (double value)
 Set the lower bound of the scale.
 
double lowerBound () const
 
void setUpperBound (double value)
 Set the upper bound of the scale.
 
double upperBound () const
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating a scale division.
 
double scaleStepSize () const
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals.
 
int scaleMaxMinor () const
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals.
 
int scaleMaxMajor () const
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine.
 
const QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
int transform (double) const
 Translate a scale value into a widget coordinate.
 
double invTransform (int) const
 Translate a widget coordinate into a scale value.
 
bool isInverted () const
 
double minimum () const
 
double maximum () const
 
const QwtScaleMapscaleMap () const
 

Protected Member Functions

virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const QWT_OVERRIDE
 Draw the needle.
 
virtual void drawHand (QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
 Draw a clock hand.
 
- Protected Member Functions inherited from QwtDial
virtual void wheelEvent (QWheelEvent *) QWT_OVERRIDE
 Wheel Event handler.
 
virtual void paintEvent (QPaintEvent *) QWT_OVERRIDE
 Paint the dial.
 
virtual void changeEvent (QEvent *) QWT_OVERRIDE
 Change Event handler.
 
virtual void drawFrame (QPainter *)
 Draw the frame around the dial.
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame.
 
virtual void drawFocusIndicator (QPainter *) const
 Draw the focus indicator.
 
void invalidateCache ()
 Invalidate the internal caches used to speed up repainting.
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 Draw the scale.
 
virtual void drawScaleContents (QPainter *painter, const QPointF &center, double radius) const
 Draw the contents inside the scale.
 
virtual double scrolledTo (const QPoint &) const QWT_OVERRIDE
 Determine the value for a new position of the slider handle.
 
virtual bool isScrollPosition (const QPoint &) const QWT_OVERRIDE
 Determine what to do when the user presses a mouse button.
 
virtual void sliderChange () QWT_OVERRIDE
 Calling update()
 
virtual void scaleChange () QWT_OVERRIDE
 Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
 
- Protected Member Functions inherited from QwtAbstractSlider
virtual void mousePressEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse press event handler.
 
virtual void mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse Release Event handler.
 
virtual void mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse Move Event handler.
 
virtual void keyPressEvent (QKeyEvent *) QWT_OVERRIDE
 Handles key events.
 
void incrementValue (int stepCount)
 Increment the slider.
 
double incrementedValue (double value, int stepCount) const
 Increment a value.
 
- Protected Member Functions inherited from QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate the scale division and update the scale.
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw.
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 
void updateScaleDraw ()
 Recalculate ticks and scale boundaries.
 

Additional Inherited Members

- Signals inherited from QwtAbstractSlider
void valueChanged (double value)
 Notify a change of value.
 
void sliderPressed ()
 This signal is emitted when the user presses the movable part of the slider.
 
void sliderReleased ()
 This signal is emitted when the user releases the movable part of the slider.
 
void sliderMoved (double value)
 This signal is emitted when the user moves the slider with the mouse.
 
- Properties inherited from QwtDial
int lineWidth
 
Shadow frameShadow
 
Mode mode
 
double origin
 
double minScaleArc
 
double maxScaleArc
 
- Properties inherited from QwtAbstractSlider
double value
 
uint totalSteps
 
uint singleSteps
 
uint pageSteps
 
bool stepAlignment
 
bool readOnly
 
bool tracking
 
bool wrapping
 
bool invertedControls
 
- Properties inherited from QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

Detailed Description

An analog clock.

Example
#include <qwt_analog_clock.h>
QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3);
clock->setLineWidth(6);
clock->setTime();
// update the clock every second
QTimer *timer = new QTimer(clock);
timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
timer->start(1000);
An analog clock.
Definition qwt_analog_clock.h:61
void setCurrentTime()
Set the current time.
Definition qwt_analog_clock.cpp:176
void setTime(const QTime &)
Set a time.
Definition qwt_analog_clock.cpp:185
void setFrameShadow(Shadow)
Sets the frame shadow value from the frame style.
Definition qwt_dial.cpp:173
@ Sunken
QFrame::Sunken.
Definition qwt_dial.h:99
void setLineWidth(int)
Sets the line width of the frame.
Definition qwt_dial.cpp:199
QwtRoundScaleDraw * scaleDraw()
Definition qwt_dial.cpp:538
Note
The examples/dials example shows how to use QwtAnalogClock.

Member Enumeration Documentation

◆ Hand

Hand type.

See also
setHand(), hand()
Enumerator
SecondHand 

Needle displaying the seconds.

MinuteHand 

Needle displaying the minutes.

HourHand 

Needle displaying the hours.

NHands 

Number of needles.

Constructor & Destructor Documentation

◆ QwtAnalogClock()

QwtAnalogClock::QwtAnalogClock ( QWidget *  parent = NULL)
explicit

Constructor.

Parameters
parentParent widget

Member Function Documentation

◆ drawHand()

void QwtAnalogClock::drawHand ( QPainter *  painter,
Hand  hd,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  cg 
) const
protectedvirtual

Draw a clock hand.

Parameters
painterPainter
hdSpecify the type of hand
centerCenter of the clock
radiusMaximum length for the hands
directionDirection of the hand in degrees, counter clockwise
cgColorGroup

◆ drawNeedle()

void QwtAnalogClock::drawNeedle ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  colorGroup 
) const
protectedvirtual

Draw the needle.

A clock has no single needle but three hands instead. drawNeedle() translates value() into directions for the hands and calls drawHand().

Parameters
painterPainter
centerCenter of the clock
radiusMaximum length for the hands
directionDummy, not used.
colorGroupColorGroup
See also
drawHand()

Reimplemented from QwtDial.

◆ hand() [1/2]

QwtDialNeedle * QwtAnalogClock::hand ( Hand  hd)
Returns
Clock hand
Parameters
hdSpecifies the type of hand
See also
setHand()

◆ hand() [2/2]

const QwtDialNeedle * QwtAnalogClock::hand ( Hand  hd) const
Returns
Clock hand
Parameters
hdSpecifies the type of hand
See also
setHand()

◆ setHand()

void QwtAnalogClock::setHand ( Hand  hand,
QwtDialNeedle needle 
)

Set a clock hand.

Parameters
handSpecifies the type of hand
needleHand
See also
hand()

◆ setTime

void QwtAnalogClock::setTime ( const QTime &  time)
slot

Set a time.

Parameters
timeTime to display

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