QWT 7.0.1
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
QwtRoundScaleDraw Class Reference

A class for drawing round scales. More...

#include <qwt_round_scale_draw.h>

Inheritance diagram for QwtRoundScaleDraw:
QwtAbstractScaleDraw QWT_FINAL QwtCompassScaleDraw

Classes

class  PrivateData
 

Public Member Functions

 QwtRoundScaleDraw ()
 Constructor.
 
virtual ~QwtRoundScaleDraw ()
 Destructor.
 
void setRadius (double radius)
 Change of radius the scale.
 
double radius () const
 Get the radius.
 
void moveCenter (double x, double y)
 Move the center of the scale draw, leaving the radius unchanged.
 
void moveCenter (const QPointF &)
 Move the center of the scale draw, leaving the radius unchanged.
 
QPointF center () const
 Get the center of the scale.
 
void setAngleRange (double angle1, double angle2)
 Adjust the baseline circle segment for round scales.
 
virtual double extent (const QFont &) const QWT_OVERRIDE
 Calculate the extent of the scale.
 
- Public Member Functions inherited from QwtAbstractScaleDraw
 QwtAbstractScaleDraw ()
 Constructor.
 
virtual ~QwtAbstractScaleDraw ()
 Destructor.
 
void setScaleDiv (const QwtScaleDiv &)
 Change the scale division.
 
const QwtScaleDivscaleDiv () const
 
void setTransformation (QwtTransform *)
 Change the transformation of the scale.
 
const QwtScaleMapscaleMap () const
 
QwtScaleMapscaleMap ()
 
void enableComponent (ScaleComponent, bool enable=true)
 En/Disable a component of the scale.
 
bool hasComponent (ScaleComponent) const
 Check if a component is enabled.
 
void setTickLength (QwtScaleDiv::TickType, double length)
 Set the length of the ticks.
 
double tickLength (QwtScaleDiv::TickType) const
 
double maxTickLength () const
 
void setSpacing (double)
 Set the spacing between tick and labels.
 
double spacing () const
 Get the spacing.
 
void setPenWidthF (qreal width)
 Specify the width of the scale pen.
 
qreal penWidthF () const
 
void setSelected (bool on)
 设置是否选中
 
bool isSelected () const
 是否选中
 
void setSelectedPenWidthOffset (qreal offset=1)
 设置坐标轴在选中状态下的画笔宽度附加值
 
qreal selectedPenWidthOffset () const
 获取当前坐标轴在选中状态下的画笔宽度附加值
 
virtual void draw (QPainter *, const QPalette &) const
 Draw the scale.
 
virtual QwtText label (double) const
 Convert a value into its representing label.
 
void setMinimumExtent (double)
 Set a minimum for the extent.
 
double minimumExtent () const
 Get the minimum extent.
 
void invalidateCache ()
 Invalidate the cache used by tickLabel()
 

Protected Member Functions

virtual void drawTick (QPainter *, double value, double len) const QWT_OVERRIDE
 Draw a tick.
 
virtual void drawBackbone (QPainter *) const QWT_OVERRIDE
 Draws the baseline of the scale.
 
virtual void drawLabel (QPainter *, double value) const QWT_OVERRIDE
 Draws the label for a major scale tick.
 
- Protected Member Functions inherited from QwtAbstractScaleDraw
const QwtTexttickLabel (const QFont &, double value) const
 Convert a value into its representing label and cache it.
 

Additional Inherited Members

- Public Types inherited from QwtAbstractScaleDraw
enum  ScaleComponent { Backbone = 0x01 , Ticks = 0x02 , Labels = 0x04 }
 Components of a scale. More...
 

Detailed Description

A class for drawing round scales.

QwtRoundScaleDraw can be used to draw round scales. The circle segment can be adjusted by setAngleRange(). The geometry of the scale can be specified with moveCenter() and setRadius().

After a scale division has been specified as a QwtScaleDiv object using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), the scale can be drawn with the QwtAbstractScaleDraw::draw() member.

Constructor & Destructor Documentation

◆ QwtRoundScaleDraw()

QwtRoundScaleDraw::QwtRoundScaleDraw ( )

Constructor.

The range of the scale is initialized to [0, 100], The center is set to (50, 50) with a radius of 50. The angle range is set to [-135, 135].

Member Function Documentation

◆ drawBackbone()

void QwtRoundScaleDraw::drawBackbone ( QPainter *  painter) const
protectedvirtual

Draws the baseline of the scale.

Parameters
painterPainter
See also
drawTick(), drawLabel()

Implements QwtAbstractScaleDraw.

◆ drawLabel()

void QwtRoundScaleDraw::drawLabel ( QPainter *  painter,
double  value 
) const
protectedvirtual

Draws the label for a major scale tick.

Parameters
painterPainter
valueValue
See also
drawTick(), drawBackbone()

Implements QwtAbstractScaleDraw.

◆ drawTick()

void QwtRoundScaleDraw::drawTick ( QPainter *  painter,
double  value,
double  len 
) const
protectedvirtual

Draw a tick.

Parameters
painterPainter
valueValue of the tick
lenLength of the tick
See also
drawBackbone(), drawLabel()

Implements QwtAbstractScaleDraw.

◆ extent()

double QwtRoundScaleDraw::extent ( const QFont &  font) const
virtual

Calculate the extent of the scale.

The extent is the distance between the baseline to the outermost pixel of the scale draw. radius() + extent() is an upper limit for the radius of the bounding circle.

Parameters
fontFont used for painting the labels
Returns
Calculated extent
See also
setMinimumExtent(), minimumExtent()
Warning
The implemented algorithm is not too smart and calculates only an upper limit, that might be a few pixels too large

Implements QwtAbstractScaleDraw.

◆ moveCenter()

void QwtRoundScaleDraw::moveCenter ( const QPointF &  center)

Move the center of the scale draw, leaving the radius unchanged.

Parameters
centerNew center
See also
setRadius()

◆ radius()

double QwtRoundScaleDraw::radius ( ) const

Get the radius.

Radius is the radius of the backbone without ticks and labels.

Returns
Radius of the scale
See also
setRadius(), extent()

◆ setAngleRange()

void QwtRoundScaleDraw::setAngleRange ( double  angle1,
double  angle2 
)

Adjust the baseline circle segment for round scales.

The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2). The default setting is [ -135, 135 ]. An angle of 0 degrees corresponds to the 12 o'clock position, and positive angles count in a clockwise direction.

Parameters
angle1
angle2boundaries of the angle interval in degrees.
Warning
  • The angle range is limited to [-360, 360] degrees. Angles exceeding this range will be clipped.
  • For angles more or equal than 360 degrees above or below min(angle1, angle2), scale marks will not be drawn.
  • If you need a counterclockwise scale, use QwtScaleDiv::setInterval()

◆ setRadius()

void QwtRoundScaleDraw::setRadius ( double  radius)

Change of radius the scale.

Radius is the radius of the backbone without ticks and labels.

Parameters
radiusNew Radius
See also
moveCenter()

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