QwtScaleDraw(3) | Qwt User's Guide | QwtScaleDraw(3) |
NAME¶
QwtScaleDraw -
SYNOPSIS¶
#include <qwt_scale_draw.h>
Inherits QwtAbstractScaleDraw.
Public Types¶
enum Alignment { BottomScale, TopScale,
LeftScale, RightScale }
Public Member Functions¶
QwtScaleDraw ()
QwtScaleDraw (const QwtScaleDraw &)
virtual ~QwtScaleDraw ()
Alignment alignment () const
QRect boundingLabelRect (const QFont &, double val) const
virtual int extent (const QPen &, const QFont &) const
void getBorderDistHint (const QFont &, int &start, int
&end) const
Qt::Alignment labelAlignment () const
QPoint labelPosition (double val) const
QRect labelRect (const QFont &, double val) const
double labelRotation () const
QSize labelSize (const QFont &, double val) const
int length () const
int maxLabelHeight (const QFont &) const
int maxLabelWidth (const QFont &) const
int minLabelDist (const QFont &) const
int minLength (const QPen &, const QFont &) const
void move (int x, int y)
void move (const QPoint &)
QwtScaleDraw & operator= (const QwtScaleDraw
&other)
Qt::Orientation orientation () const
QPoint pos () const
void setAlignment (Alignment)
void setLabelAlignment (Qt::Alignment)
void setLabelRotation (double rotation)
void setLength (int length)
Protected Member Functions¶
virtual void drawBackbone (QPainter *p) const
virtual void drawLabel (QPainter *p, double val) const
virtual void drawTick (QPainter *p, double val, int len) const
QMatrix labelMatrix (const QPoint &, const QSize &) const
Detailed Description¶
A class for drawing scales.
QwtScaleDraw can be used to draw linear or logarithmic scales. A scale has a position, an alignment and a length, which can be specified . The labels can be rotated and aligned to the ticks using setLabelRotation() and setLabelAlignment().
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.
Member Enumeration Documentation¶
enum QwtScaleDraw::Alignment¶
Alignment of the scale draw
See also:
Constructor & Destructor Documentation¶
QwtScaleDraw::QwtScaleDraw ()¶
Constructor. The range of the scale is initialized to [0, 100], The position is at (0, 0) with a length of 100. The orientation is QwtAbstractScaleDraw::Bottom.
Member Function Documentation¶
QwtScaleDraw::Alignment QwtScaleDraw::alignment () const¶
Return alignment of the scale
See also:
QRect QwtScaleDraw::boundingLabelRect (const QFont &font, doublevalue) const¶
Find the bounding rect for the label. The coordinates of the rect are absolute coordinates ( calculated from pos() ). in direction of the tick.
Parameters:
value Value
See also:
void QwtScaleDraw::drawBackbone (QPainter *painter) const [protected], [virtual]¶
Draws the baseline of the scale
Parameters:
See also:
Implements QwtAbstractScaleDraw.
void QwtScaleDraw::drawLabel (QPainter *painter, doublevalue) const [protected], [virtual]¶
Draws the label for a major scale tick
Parameters:
value Value
See also:
Implements QwtAbstractScaleDraw.
void QwtScaleDraw::drawTick (QPainter *painter, doublevalue, intlen) const [protected], [virtual]¶
Draw a tick
Parameters:
value Value of the tick
len Lenght of the tick
See also:
Implements QwtAbstractScaleDraw.
int QwtScaleDraw::extent (const QPen &pen, const QFont &font) const [virtual]¶
Calculate the width/height that is needed for a vertical/horizontal scale.
The extent is calculated from the pen width of the backbone, the major tick length, the spacing and the maximum width/height of the labels.
Parameters:
font Font used for painting the labels
See also:
Implements QwtAbstractScaleDraw.
void QwtScaleDraw::getBorderDistHint (const QFont &font, int &start, int &end) const¶
Determine the minimum border distance. This member function returns the minimum space needed to draw the mark labels at the scale's endpoints.
Parameters:
start Start border distance
end End border distance
Qt::Alignment QwtScaleDraw::labelAlignment () const¶
Returns:
See also:
QMatrix QwtScaleDraw::labelMatrix (const QPoint &pos, const QSize &size) const [protected]¶
Calculate the matrix that is needed to paint a label depending on its alignment and rotation.
Parameters:
size Size of the label
See also:
QPoint QwtScaleDraw::labelPosition (doublevalue) const¶
Find the position, where to paint a label
The position has a distance of majTickLength() + spacing() + 1 from the backbone. The direction depends on the alignment()
Parameters:
QRect QwtScaleDraw::labelRect (const QFont &font, doublevalue) const¶
Find the bounding rect for the label. The coordinates of the rect are relative to spacing + ticklength from the backbone in direction of the tick.
Parameters:
value Value
double QwtScaleDraw::labelRotation () const¶
Returns:
See also:
QSize QwtScaleDraw::labelSize (const QFont &font, doublevalue) const¶
Calculate the size that is needed to draw a label
Parameters:
value Value
int QwtScaleDraw::length () const¶
Returns:
See also:
int QwtScaleDraw::maxLabelHeight (const QFont &font) const¶
Parameters:
Returns:
int QwtScaleDraw::maxLabelWidth (const QFont &font) const¶
Parameters:
Returns:
int QwtScaleDraw::minLabelDist (const QFont &font) const¶
Determine the minimum distance between two labels, that is necessary that the texts don't overlap.
Parameters:
Returns:
See also:
int QwtScaleDraw::minLength (const QPen &pen, const QFont &font) const¶
Calculate the minimum length that is needed to draw the scale
Parameters:
font Font used for painting the labels
See also:
void QwtScaleDraw::move (intx, inty) [inline]¶
Move the position of the scale
See also:
void QwtScaleDraw::move (const QPoint &pos)¶
Move the position of the scale. The meaning of the parameter pos depends on the alignment:
- QwtScaleDraw::LeftScale
- The origin is the topmost point of the backbone. The backbone is a vertical line. Scale marks and labels are drawn at the left of the backbone.
- QwtScaleDraw::RightScale
- The origin is the topmost point of the backbone. The backbone is a vertical line. Scale marks and labels are drawn at the right of the backbone.
- QwtScaleDraw::TopScale
- The origin is the leftmost point of the backbone. The backbone is a horizontal line. Scale marks and labels are drawn above the backbone.
- QwtScaleDraw::BottomScale
- The origin is the leftmost point of the backbone. The backbone is a horizontal line Scale marks and labels are drawn below the backbone.
Parameters:
See also:
Qt::Orientation QwtScaleDraw::orientation () const¶
Return the orientation
TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales.
See also:
QPoint QwtScaleDraw::pos () const¶
Returns:
See also:
void QwtScaleDraw::setAlignment (Alignmentalign)¶
Set the alignment of the scale
The default alignment is QwtScaleDraw::BottomScale
See also:
void QwtScaleDraw::setLabelAlignment (Qt::Alignmentalignment)¶
Change the label flags. Labels are aligned to the point ticklength + spacing away from the backbone.
The alignment is relative to the orientation of the label text. In case of an flags of 0 the label will be aligned depending on the orientation of the scale:
QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter
Changing the alignment is often necessary for rotated labels.
Parameters:
See also:
Warning:
void QwtScaleDraw::setLabelRotation (doublerotation)¶
Rotate all labels.
When changing the rotation, it might be necessary to adjust the label flags too. Finding a useful combination is often the result of try and error.
Parameters:
See also:
void QwtScaleDraw::setLength (intlength)¶
Set the length of the backbone.
The length doesn't include the space needed for overlapping labels.
See also:
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Tue Nov 20 2012 | Version 5.2.3 |