10#include "qwt_analog_clock.h" 
   11#include "qwt_dial_needle.h" 
   12#include "qwt_round_scale_draw.h" 
   24        QwtAnalogClockScaleDraw()
 
   37        virtual QwtText label( 
double value ) 
const QWT_OVERRIDE
 
   39            if ( qFuzzyCompare( value + 1.0, 1.0 ) )
 
   40                value = 60.0 * 60.0 * 12.0;
 
   42            return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
 
   62    const int secondsPerHour = 60.0 * 60.0;
 
   67    for ( 
int i = 0; i < 12; i++ )
 
   69        majorTicks += i * secondsPerHour;
 
   71        for ( 
int j = 1; j < 5; j++ )
 
   72            minorTicks += i * secondsPerHour + j * secondsPerHour / 5.0;
 
   81    QColor knobColor = palette().color( QPalette::Active, QPalette::Text );
 
   82    knobColor = knobColor.darker( 120 );
 
   87    for ( 
int i = 0; i < 
NHands; i++ )
 
   92            handColor = knobColor.darker( 120 );
 
   97            handColor = knobColor;
 
  102        hand->setWidth( width );
 
 
  112    for ( 
int i = 0; i < 
NHands; i++ )
 
 
  148    if ( hd < 0 || hd >= 
NHands )
 
 
  169    setTime( QTime::currentTime() );
 
 
  178    if ( time.isValid() )
 
  180        setValue( ( time.hour() % 12 ) * 60.0 * 60.0
 
  181            + time.minute() * 60.0 + time.second() );
 
 
  203    double radius, 
double direction, QPalette::ColorGroup colorGroup )
 const 
  205    Q_UNUSED( direction );
 
  209        const double hours = 
value() / ( 60.0 * 60.0 );
 
  210        const double minutes =
 
  211            ( 
value() - std::floor(hours) * 60.0 * 60.0 ) / 60.0;
 
  212        const double seconds = 
value() - std::floor(hours) * 60.0 * 60.0
 
  213            - std::floor(minutes) * 60.0;
 
  216        angle[
HourHand] = 360.0 * hours / 12.0;
 
  222            const double d = 360.0 - angle[
hand] - 
origin();
 
  224                center, radius, d, colorGroup );
 
 
  240    const QPointF& center, 
double radius, 
double direction,
 
  241    QPalette::ColorGroup cg )
 const 
  247            radius = qRound( 0.8 * radius );
 
  249        needle->
draw( painter, center, radius, direction, cg );
 
 
  253#include "moc_qwt_analog_clock.cpp" 
@ Backbone
Backbone = the line where the ticks are located.
const QwtScaleDiv & scaleDiv() const
void setScale(double lowerBound, double upperBound)
Specify a scale.
void setTotalSteps(uint)
Set the number of steps.
void setValue(double value)
double value() const
Returns the current value.
void setCurrentTime()
Set the current time.
virtual ~QwtAnalogClock()
Destructor.
const QwtDialNeedle * hand(Hand) const
void setHand(Hand, QwtDialNeedle *)
virtual void drawHand(QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
void setTime(const QTime &)
@ NHands
Number of needles.
@ MinuteHand
Needle displaying the minutes.
@ HourHand
Needle displaying the hours.
@ SecondHand
Needle displaying the seconds.
virtual void drawNeedle(QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const override
Draw the needle.
QwtAnalogClock(QWidget *parent=NULL)
QwtDial class provides a rounded range control.
void setScaleDraw(QwtRoundScaleDraw *)
virtual void setOrigin(double)
Change the origin.
const QwtDialNeedle * needle() const
Base class for needles that can be used in a QwtDial.
virtual void draw(QPainter *, const QPointF ¢er, double length, double direction, QPalette::ColorGroup=QPalette::Active) const
A needle for dial widgets.
A class for drawing round scales.
A class representing a scale division.
void setInterval(double lowerBound, double upperBound)
@ MediumTick
Medium ticks.
void setTicks(int tickType, const QList< double > &)
A class representing a text.