QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtScaleDraw Class Reference

A class for drawing scales. More...

#include <qwt_scale_draw.h>

Inheritance diagram for QwtScaleDraw:
QwtAbstractScaleDraw QwtDateScaleDraw

Classes

class  PrivateData
 

Public Types

enum  Alignment { BottomScale , TopScale , LeftScale , RightScale }
 Alignment of the scale draw. More...
 
- Public Types inherited from QwtAbstractScaleDraw
enum  ScaleComponent { Backbone = 0x01 , Ticks = 0x02 , Labels = 0x04 }
 Components of a scale. More...
 

Public Member Functions

 QwtScaleDraw ()
 Constructor.
 
virtual ~QwtScaleDraw ()
 Destructor.
 
void getBorderDistHint (const QFont &, int &start, int &end) const
 Get the border distance hint.
 
int minLabelDist (const QFont &) const
 Get the minimum label distance.
 
int minLength (const QFont &) const
 Get the minimum length.
 
virtual double extent (const QFont &) const override
 Calculate the width/height that is needed for a vertical/horizontal scale.
 
void move (double x, double y)
 Move the position of the scale.
 
void move (const QPointF &)
 Move the position of the scale.
 
void setLength (double length)
 Set the length of the backbone.
 
Alignment alignment () const
 Return alignment of the scale.
 
void setAlignment (Alignment)
 Set the alignment.
 
Qt::Orientation orientation () const
 Return the orientation.
 
QPointF pos () const
 Get origin of the scale.
 
double length () const
 Get the length of the backbone.
 
void setLabelAlignment (Qt::Alignment)
 Set the label alignment.
 
Qt::Alignment labelAlignment () const
 Get the label flags.
 
void setLabelRotation (double rotation)
 Set the label rotation.
 
double labelRotation () const
 Get the label rotation.
 
int maxLabelHeight (const QFont &) const
 Get the maximum label height.
 
int maxLabelWidth (const QFont &) const
 Get the maximum label width.
 
QPointF labelPosition (double value) const
 Get the label position for a value.
 
QRectF labelRect (const QFont &, double value) const
 Get the label rectangle for a value.
 
QSizeF labelSize (const QFont &, double value) const
 Get the label size for a value.
 
QRect boundingLabelRect (const QFont &, double value) const
 Get the bounding label rectangle.
 
- Public Member Functions inherited from QwtAbstractScaleDraw
 QwtAbstractScaleDraw ()
 Constructor for QwtAbstractScaleDraw.
 
virtual ~QwtAbstractScaleDraw ()
 Destructor for QwtAbstractScaleDraw .
 
void setScaleDiv (const QwtScaleDiv &)
 Set the scale division.
 
const QwtScaleDivscaleDiv () const
 Return the scale division.
 
void setTransformation (QwtTransform *)
 Set the scale transformation.
 
const QwtScaleMapscaleMap () const
 Return the scale map (const version)
 
QwtScaleMapscaleMap ()
 Return the scale map (non-const version)
 
void enableComponent (ScaleComponent, bool enable=true)
 Enable or disable a scale component.
 
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
 Get the length of the ticks.
 
double maxTickLength () const
 Get the length of the longest tick.
 
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
 Get the scale pen width.
 
void setSelected (bool on)
 Set whether the scale draw is selected.
 
bool isSelected () const
 Check if the scale draw is selected.
 
void setSelectedPenWidthOffset (qreal offset=1)
 Set the pen width offset for the axis when it is in selected state.
 
qreal selectedPenWidthOffset () const
 Get the current pen width offset for the axis when it is in selected state.
 
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

QTransform labelTransformation (const QPointF &, const QSizeF &) const
 Calculate the transformation that is needed to paint a label.
 
virtual void drawTick (QPainter *, double value, double len) const override
 Draw a tick.
 
virtual void drawBackbone (QPainter *) const override
 Draws the baseline of the scale.
 
virtual void drawLabel (QPainter *, double value) const 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.
 

Detailed Description

A class for drawing scales.

Member Enumeration Documentation

◆ Alignment

Alignment of the scale draw.

Enumerator
BottomScale 

The scale is below.

TopScale 

The scale is above.

LeftScale 

The scale is left.

RightScale 

The scale is right.

Constructor & Destructor Documentation

◆ QwtScaleDraw()

QwtScaleDraw::QwtScaleDraw ( )

Constructor.

Member Function Documentation

◆ alignment()

QwtScaleDraw::Alignment QwtScaleDraw::alignment ( ) const

Return alignment of the scale.

Returns
the alignment

◆ boundingLabelRect()

QRect QwtScaleDraw::boundingLabelRect ( const QFont &  font,
double  value 
) const

Get the bounding label rectangle.

Find the bounding rectangle for the label.

◆ drawBackbone()

void QwtScaleDraw::drawBackbone ( QPainter *  painter) const
overrideprotectedvirtual

Draws the baseline of the scale.

Implements QwtAbstractScaleDraw.

◆ drawLabel()

void QwtScaleDraw::drawLabel ( QPainter *  painter,
double  value 
) const
overrideprotectedvirtual

Draws the label for a major scale tick.

Implements QwtAbstractScaleDraw.

◆ drawTick()

void QwtScaleDraw::drawTick ( QPainter *  painter,
double  value,
double  len 
) const
overrideprotectedvirtual

Draw a tick.

Implements QwtAbstractScaleDraw.

◆ extent()

double QwtScaleDraw::extent ( const QFont &  font) const
overridevirtual

Calculate the width/height that is needed for a vertical/horizontal scale.

Implements QwtAbstractScaleDraw.

◆ getBorderDistHint()

void QwtScaleDraw::getBorderDistHint ( const QFont &  font,
int &  start,
int &  end 
) const

Get the border distance hint.

Determine the minimum border distance.

◆ labelAlignment()

Qt::Alignment QwtScaleDraw::labelAlignment ( ) const

Get the label flags.

Returns
the label alignment

◆ labelPosition()

QPointF QwtScaleDraw::labelPosition ( double  value) const

Get the label position for a value.

Find the position, where to paint a label.

◆ labelRect()

QRectF QwtScaleDraw::labelRect ( const QFont &  font,
double  value 
) const

Get the label rectangle for a value.

Find the bounding rectangle for the label.

◆ labelRotation()

double QwtScaleDraw::labelRotation ( ) const

Get the label rotation.

Returns
the label rotation

◆ labelSize()

QSizeF QwtScaleDraw::labelSize ( const QFont &  font,
double  value 
) const

Get the label size for a value.

Calculate the size that is needed to draw a label.

◆ labelTransformation()

QTransform QwtScaleDraw::labelTransformation ( const QPointF &  pos,
const QSizeF &  size 
) const
protected

Calculate the transformation that is needed to paint a label.

◆ length()

double QwtScaleDraw::length ( ) const

Get the length of the backbone.

Returns
the length

◆ maxLabelHeight()

int QwtScaleDraw::maxLabelHeight ( const QFont &  font) const

Get the maximum label height.

Get the maximum height of a label.

◆ maxLabelWidth()

int QwtScaleDraw::maxLabelWidth ( const QFont &  font) const

Get the maximum label width.

Get the maximum width of a label.

◆ minLabelDist()

int QwtScaleDraw::minLabelDist ( const QFont &  font) const

Get the minimum label distance.

Determine the minimum distance between two labels.

◆ minLength()

int QwtScaleDraw::minLength ( const QFont &  font) const

Get the minimum length.

Calculate the minimum length that is needed to draw the scale.

◆ move() [1/2]

void QwtScaleDraw::move ( const QPointF &  pos)

Move the position of the scale.

◆ move() [2/2]

void QwtScaleDraw::move ( double  x,
double  y 
)
inline

Move the position of the scale.

◆ orientation()

Qt::Orientation QwtScaleDraw::orientation ( ) const

Return the orientation.

Returns
the orientation

◆ pos()

QPointF QwtScaleDraw::pos ( ) const

Get origin of the scale.

Returns
the position

◆ setAlignment()

void QwtScaleDraw::setAlignment ( Alignment  align)

Set the alignment.

Set the alignment of the scale.

◆ setLabelAlignment()

void QwtScaleDraw::setLabelAlignment ( Qt::Alignment  alignment)

Set the label alignment.

Change the label flags.

◆ setLabelRotation()

void QwtScaleDraw::setLabelRotation ( double  rotation)

Set the label rotation.

Rotate all labels.

◆ setLength()

void QwtScaleDraw::setLength ( double  length)

Set the length of the backbone.


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