Inheritance diagram for QwtScaleDraw:
QwtScaleDraw can be used to draw linear or logarithmic scales. A scale has an origin, an orientation and a length, which all can be specified with QwtScaleDraw::setGeometry(). The labels can be rotated and aligned to the ticks using QwtScaleDraw::setLabelRotation(), QwtScaleDraw::setLabelAlignment().
After a scale division has been specified as a QwtScaleDiv object using QwtScaleDraw::setScale(const QwtScaleDiv &s), or determined internally using QwtScaleDraw::setScale(double vmin, double vmax, int maxMajIntv, int maxMinIntv, double step = 0.0, int logarithmic = 0), the scale can be drawn with the QwtScaleDraw::draw() member.
Public Types | |
enum | Orientation { Bottom, Top, Left, Right, Round } |
enum | Option { None = 0, Backbone = 1 } |
Public Member Functions | |
QwtScaleDraw () | |
virtual | ~QwtScaleDraw () |
void | setScale (const QwtScaleDiv &s) |
void | setScale (double vmin, double vmax, int maxMajIntv, int maxMinIntv, double step=0.0, int logarithmic=0) |
void | setOptions (int opt) |
int | options () const |
void | setGeometry (int xorigin, int yorigin, int length, Orientation o) |
int | x () const |
int | y () const |
int | length () const |
Orientation | orientation () const |
void | setAngleRange (double angle1, double angle2) |
void | setLabelFormat (char f, int prec, int fieldwidth=0) |
void | setLabelAlignment (int align) |
void | setLabelRotation (double rotation) |
void | setTickLength (unsigned int minLen, unsigned int medLen, unsigned int majLen) |
void | setMargin (uint hMargin, uint vMargin) |
const QwtScaleDiv & | scaleDiv () const |
int | maxWidth (const QPen &pen, const QFontMetrics &fm) const |
int | maxHeight (const QPen &pen, const QFontMetrics &fm) const |
void | minBorderDist (const QFontMetrics &fm, int &start, int &end) const |
int | minLabelDist (const QFontMetrics &fm) const |
int | minHeight (const QPen &pen, const QFontMetrics &fm) const |
int | minWidth (const QPen &pen, const QFontMetrics &fm) const |
void | labelFormat (char &f, int &prec, int &fieldwidth) const |
int | labelAlignment () const |
double | labelRotation () const |
void | tickLength (unsigned int &minLen, unsigned int &medLen, unsigned int &majLen) const |
unsigned int | majTickLength () const |
virtual void | draw (QPainter *p) const |
virtual QString | label (double) const |
Protected Member Functions | |
virtual void | labelPlacement (const QFontMetrics &, double val, QPoint &pos, int &alignment, double &rotation) const |
virtual int | maxLabelHeight (const QFontMetrics &) const |
virtual int | maxLabelWidth (const QFontMetrics &) const |
QRect | labelBoundingRect (const QFontMetrics &, double val) const |
void | drawTick (QPainter *p, double val, int len) const |
void | drawBackbone (QPainter *p) const |
void | drawLabel (QPainter *p, double val) const |
QWMatrix | labelWorldMatrix (const QFontMetrics &, const QPoint &, int alignment, double rotation, const QString &) const |
|
Orientation/Position of the scale draw
|
|
Constructor. The range of the scale is initialized to [0, 100], the angle range is set to [-135, 135], the geometry is initialized such that the origin is at (0,0), the length is 100, and the orientation is QwtScaleDraw::Bottom. |
|
Destructor.
|
|
Draw the scale.
|
|
Draws the baseline of the scale.
|
|
Draws the number label for a major scale tick.
|
|
Draws a single scale tick.
|
|
Convert a value into its representing label using the labelFormat.
Reimplemented in QwtDialScaleDraw. |
|
|
|
Find the bounding rect for the label. The coordinates of the rect are relative to margin + ticklength from the backbone in direction of the tick. |
|
Format character and precision have the same meaning as for the QString class.
|
|
Find position, alignment and rotation of the label.
|
|
|
|
Return the world matrix for painting the label.
|
|
Return length.
|
|
Return the length of the major ticks
|
|
|
|
|
|
|
|
|
|
Determine the minimum border distance. This member function returns the minimum space needed to draw the mark labels at the scale's endpoints.
|
|
|
|
Determine the minimum distance between two labels, that is necessairy that the texts don't overlap.
|
|
|
|
Return scale orientation.
|
|
|
|
Adjust the baseline circle segment for round scales. The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2). The settings have no effect if the scale orientation is not set to QwtScaleDraw::Round. 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.
|
|
Specify the geometry of the scale. The parameters xorigin, yorigin and length have different meanings, dependent on the orientation:
|
|
Labels are aligned to the point ticklength + margin away from the backbone. The alignment is relative to the orientation of the label text. In case of an alignment of 0 the label will be aligned depending on the orientation of the scale:
QwtScaleDraw::Top: Qt::AlignHCenter | Qt::AlignTop Changing the alignment is often necessary for rotated labels.
|
|
Set the number format for the major scale labels. Format character and precision have the same meaning as for the QString class.
|
|
Rotate all labels.
|
|
Set the margins of the ticks
|
|
Adjust the range of the scale. If step == 0.0, the step width is calculated automatically dependent on the maximal number of scale ticks.
|
|
Change the scale division.
|
|
Set the length of the ticks |
|
Return the length of the ticks
|
|
Return x origin.
|
|
Return y origin.
|