Back to index

kdeartwork  4.3.2
Public Member Functions
ClockPainter Class Reference

#include <kclock.h>

List of all members.

Public Member Functions

 ClockPainter (QPaintDevice *device, int diameter)
void drawTick (double angle, double from, double to, double width, const QColor &, bool shadow=false)
void drawDisc (double width, const QColor &, bool shadow=false)
void drawHand (double angle, double length, double width, const QColor &, bool disc=true)
void drawScale (const QColor &)

Detailed Description

Definition at line 66 of file kclock.h.


Constructor & Destructor Documentation

ClockPainter::ClockPainter ( QPaintDevice *  device,
int  diameter 
)

Definition at line 310 of file kclock.cpp.

                                                             :
       QPainter(device)
{
       setRenderHint(QPainter::Antialiasing);
       translate(diameter / 2.0, diameter / 2.0);
       scale(diameter / 2000.0, -diameter / 2000.0);
       setPen(Qt::NoPen);
}

Member Function Documentation

void ClockPainter::drawDisc ( double  width,
const QColor &  color,
bool  shadow = false 
)

Definition at line 336 of file kclock.cpp.

{
       if (shadow) {
              width += 1.0;
              setBrush(QColor(100, 100, 100));
       } else {
              setBrush(color);
       }
       drawEllipse(QRectF(-width, -width, 2.0 * width, 2.0 * width));
}

Here is the caller graph for this function:

void ClockPainter::drawHand ( double  angle,
double  length,
double  width,
const QColor &  color,
bool  disc = true 
)

Definition at line 348 of file kclock.cpp.

{
       if (disc)
              drawDisc(width * 1.3, color, true);
       drawTick(angle, 0.0, length, width, color, true);

       if (disc)
              drawDisc(width * 1.3, color, false);
       drawTick(angle, 0.0, length, width, color, false);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void ClockPainter::drawScale ( const QColor &  color)

Definition at line 361 of file kclock.cpp.

{
       for (int i = 0; i < 360; i += 6)
              if (i % 30)
                     drawTick(i, 920.0, 980.0, 15.0, color);
              else
                     drawTick(i, 825.0, 980.0, 40.0, color);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ClockPainter::drawTick ( double  angle,
double  from,
double  to,
double  width,
const QColor &  color,
bool  shadow = false 
)

Definition at line 320 of file kclock.cpp.

{
       save();
       rotate(90.0 - angle);

       if (shadow) {
              width += 1.0;
              setBrush(QColor(100, 100, 100));
       } else {
              setBrush(color);
       }
       drawRect(QRectF(from, -width / 2.0, to - from, width));
       restore();
}

Here is the caller graph for this function:


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