33 if ( qFuzzyCompare( value + 1.0, 1.0 ) )
34 value = 60.0 * 60.0 * 12.0;
36 return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
55 const int secondsPerHour = 60.0 * 60.0;
57 QList<double> majorTicks;
58 QList<double> minorTicks;
60 for (
int i = 0;
i < 12;
i++ )
62 majorTicks +=
i * secondsPerHour;
64 for (
int j = 1; j < 5; j++ )
65 minorTicks +=
i * secondsPerHour + j * secondsPerHour / 5.0;
74 QColor knobColor = palette().color( QPalette::Active, QPalette::Text );
75 knobColor = knobColor.dark( 120 );
85 handColor = knobColor.dark( 120 );
90 handColor = knobColor;
98 setHand( static_cast<Hand>(
i ), hand );
127 if ( hand >= 0 && hand <
NHands )
141 if ( hd < 0 || hd >=
NHands )
162 setTime( QTime::currentTime() );
171 if ( time.isValid() )
173 setValue( ( time.hour() % 12 ) * 60.0 * 60.0
174 + time.minute() * 60.0 + time.second() );
196 double radius,
double dir, QPalette::ColorGroup colorGroup )
const 202 const double hours =
value() / ( 60.0 * 60.0 );
203 const double minutes =
204 (
value() - qFloor(hours) * 60.0 * 60.0 ) / 60.0;
205 const double seconds =
value() - qFloor(hours) * 60.0 * 60.0
206 - qFloor(minutes) * 60.0;
209 angle[
HourHand] = 360.0 * hours / 12.0;
217 center, radius, d, colorGroup );
233 const QPointF ¢er,
double radius,
double direction,
234 QPalette::ColorGroup cg )
const 240 radius = qRound( 0.8 * radius );
242 needle->
draw( painter, center, radius, direction, cg );
void setNeedle(QwtDialNeedle *)
virtual ~QwtAnalogClock()
Destructor.
void setScale(double lowerBound, double upperBound)
Specify a scale.
void setHand(Hand, QwtDialNeedle *)
Needle displaying the minutes.
QwtAnalogClockScaleDraw()
QwtDialNeedle * d_hand[NHands]
void setValue(double val)
void setTicks(int tickType, const QList< double > &)
virtual void setOrigin(double)
Change the origin.
void setSpacing(double margin)
Set the spacing between tick and labels.
A class representing a scale division.
void setCurrentTime()
Set the current time.
QwtAnalogClock(QWidget *parent=NULL)
virtual void drawNeedle(QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
Draw the needle.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
QwtDial class provides a rounded range control.
void setInterval(double lowerBound, double upperBound)
std::chrono::duration< std::int_fast64_t > seconds
Base class for needles that can be used in a QwtDial.
const QwtScaleDiv & scaleDiv() const
void setTotalSteps(uint)
Set the number of steps.
const QwtDialNeedle * needle() const
A class representing a text.
Needle displaying the hours.
Backbone = the line where the ticks are located.
A needle for dial widgets.
void setTickLength(QwtScaleDiv::TickType, double length)
void enableComponent(ScaleComponent, bool enable=true)
A class for drawing round scales.
void setWidth(double width)
virtual QwtText label(double value) const
Convert a value into its representing label.
void setPenWidth(int width)
Specify the width of the scale pen.
void setScaleDraw(QwtRoundScaleDraw *)
virtual void draw(QPainter *painter, const QPointF ¢er, double length, double direction, QPalette::ColorGroup=QPalette::Active) const
const QwtDialNeedle * hand(Hand) const
virtual void drawHand(QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
Needle displaying the seconds.
void setTime(const QTime &)