17 #include <qfontmetrics.h> 122 angle1 = qBound( -360.0, angle1, 360.0 );
123 angle2 = qBound( -360.0, angle2, 360.0 );
169 const QSizeF sz = label.
textSize( painter->font() );
173 ( radius + sz.width() / 2.0 ) * qSin( arc );
175 ( radius + sz.height() / 2.0 ) * qCos( arc );
177 const QRectF r( x - sz.width() / 2, y - sz.height() / 2,
178 sz.width(), sz.height() );
179 label.
draw( painter, r );
207 const double sinArc = qSin( arc );
208 const double cosArc = qCos( arc );
210 const double x1 = cx + radius * sinArc;
211 const double x2 = cx + ( radius + len ) * sinArc;
212 const double y1 = cy - radius * cosArc;
213 const double y2 = cy - ( radius + len ) * cosArc;
230 const int a1 = qRound( qMin( deg1, deg2 ) - 90 );
231 const int a2 = qRound( qMax( deg1, deg2 ) - 90 );
237 painter->drawArc( QRectF( x, y, 2 * radius, 2 * radius ),
238 -a2 * 16, ( a2 - a1 + 1 ) * 16 );
264 for (
int i = 0;
i < ticks.count();
i++ )
266 const double value = ticks[
i];
280 const QSizeF sz = label.
textSize( font );
281 const double off = qMax( sz.width(), sz.height() );
283 double x = off * qSin( arc );
284 double y = off * qCos( arc );
286 const double dist = qSqrt( x * x + y * y );
300 const double pw = qMax( 1,
penWidth() );
static void drawLine(QPainter *, double x1, double y1, double x2, double y2)
Wrapper for QPainter::drawLine()
virtual void drawTick(QPainter *, double val, double len) const
virtual ~QwtRoundScaleDraw()
Destructor.
void draw(QPainter *painter, const QRectF &rect) const
virtual double extent(const QFont &) const
A class representing a scale division.
const QwtScaleMap & scaleMap() const
TFSIMD_FORCE_INLINE const tfScalar & y() const
double minimumExtent() const
void moveCenter(double x, double y)
Move the center of the scale draw, leaving the radius unchanged.
QPointF center() const
Get the center of the scale.
QSizeF textSize(const QFont &=QFont()) const
bool contains(double value) const
double qwtRadians(double degrees)
Translate degrees into radians.
const QwtScaleDiv & scaleDiv() const
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
A class representing a text.
QwtRoundScaleDraw()
Constructor.
double maxTickLength() const
TFSIMD_FORCE_INLINE const tfScalar & x() const
Backbone = the line where the ticks are located.
virtual QwtText label(double) const
Convert a value into its representing label.
virtual void drawLabel(QPainter *, double val) const
void setAngleRange(double angle1, double angle2)
Adjust the baseline circle segment for round scales.
const QwtText & tickLabel(const QFont &, double value) const
Convert a value into its representing label and cache it.
bool hasComponent(ScaleComponent) const
void setRadius(double radius)
double transform(double s) const
virtual void drawBackbone(QPainter *) const
QList< double > ticks(int tickType) const
double tickLength(QwtScaleDiv::TickType) const
double spacing() const
Get the spacing.