Go to the documentation of this file.
17 #include <qdatetime.h>
24 QwtAnalogClockScaleDraw()
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() )
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;
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 );
254 #include "moc_qwt_analog_clock.cpp"
A class for drawing round scales.
const QwtDialNeedle * needle() const
Base class for needles that can be used in a QwtDial.
QwtDial class provides a rounded range control.
@ HourHand
Needle displaying the hours.
virtual void drawNeedle(QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const QWT_OVERRIDE
Draw the needle.
void setSpacing(double)
Set the spacing between tick and labels.
@ MediumTick
Medium ticks.
virtual ~QwtAnalogClock()
Destructor.
QwtDialNeedle * m_hand[NHands]
void setValue(double value)
void setHand(Hand, QwtDialNeedle *)
void setInterval(double lowerBound, double upperBound)
const QwtDialNeedle * hand(Hand) const
@ SecondHand
Needle displaying the seconds.
virtual void draw(QPainter *, const QPointF ¢er, double length, double direction, QPalette::ColorGroup=QPalette::Active) const
@ Backbone
Backbone = the line where the ticks are located.
void setScaleDraw(QwtRoundScaleDraw *)
void setTime(const QTime &)
virtual void setOrigin(double)
Change the origin.
void enableComponent(ScaleComponent, bool enable=true)
A class representing a text.
A needle for dial widgets.
void setCurrentTime()
Set the current time.
const QwtScaleDiv & scaleDiv() const
void setTickLength(QwtScaleDiv::TickType, double length)
void setTotalSteps(uint)
Set the number of steps.
@ MinuteHand
Needle displaying the minutes.
virtual QwtText label(double) const
Convert a value into its representing label.
double value
Returns the current value.
@ NHands
Number of needles.
@ value
the parser finished reading a JSON value
void setNeedle(QwtDialNeedle *)
void setPenWidthF(qreal width)
Specify the width of the scale pen.
void setScale(double lowerBound, double upperBound)
Specify a scale.
void setTicks(int tickType, const QList< double > &)
QwtAnalogClock(QWidget *parent=NULL)
A class representing a scale division.
virtual void drawHand(QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45