

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.
Definition at line 30 of file qwt_scale_draw.h.
| Public Types | |
| enum | Alignment { BottomScale, TopScale, LeftScale, RightScale } | 
| Public Member Functions | |
| QwtScaleDraw () | |
| QwtScaleDraw (const QwtScaleDraw &) | |
| virtual | ~QwtScaleDraw () | 
| QwtScaleDraw & | operator= (const QwtScaleDraw &other) | 
| void | getBorderDistHint (const QFont &, int &start, int &end) const | 
| int | minLabelDist (const QFont &) const | 
| int | minLength (const QPen &, const QFont &) const | 
| virtual int | extent (const QPen &, const QFont &) const | 
| void | move (int x, int y) | 
| void | move (const QPoint &) | 
| void | setLength (int length) | 
| Alignment | alignment () const | 
| void | setAlignment (Alignment) | 
| Qt::Orientation | orientation () const | 
| QPoint | pos () const | 
| int | length () const | 
| void | setLabelAlignment (Qt::Alignment) | 
| Qt::Alignment | labelAlignment () const | 
| void | setLabelRotation (double rotation) | 
| double | labelRotation () const | 
| int | maxLabelHeight (const QFont &) const | 
| int | maxLabelWidth (const QFont &) const | 
| QPoint | labelPosition (double val) const | 
| QRect | labelRect (const QFont &, double val) const | 
| QSize | labelSize (const QFont &, double val) const | 
| Protected Member Functions | |
| QMatrix | labelMatrix (const QPoint &, const QSize &) const | 
| virtual void | drawTick (QPainter *p, double val, int len) const | 
| virtual void | drawBackbone (QPainter *p) const | 
| virtual void | drawLabel (QPainter *p, double val) const | 
| 
 | 
| Alignment of the scale draw 
 Definition at line 37 of file qwt_scale_draw.h. | 
| 
 | 
| 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. Definition at line 60 of file qwt_scale_draw.cpp. References setLength(). | 
| 
 | 
| Copy constructor. 
 Definition at line 67 of file qwt_scale_draw.cpp. References d_data. | 
| 
 | 
| Destructor. 
 Definition at line 74 of file qwt_scale_draw.cpp. | 
| 
 | 
| Return alignment of the scale 
 Definition at line 91 of file qwt_scale_draw.cpp. Referenced by QwtScaleWidget::alignment(), drawBackbone(), labelMatrix(), and labelPosition(). | 
| 
 | 
| Draws the baseline of the scale 
 
 Implements QwtAbstractScaleDraw. Definition at line 507 of file qwt_scale_draw.cpp. References alignment(), QwtPainter::drawLine(), and pos(). | 
| 
 | ||||||||||||
| Draws the label for a major scale tick 
 
 
 Implements QwtAbstractScaleDraw. Definition at line 612 of file qwt_scale_draw.cpp. References QwtText::draw(), QwtText::isEmpty(), labelMatrix(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel(). | 
| 
 | ||||||||||||||||
| Draw a tick 
 
 
 Implements QwtAbstractScaleDraw. Definition at line 406 of file qwt_scale_draw.cpp. References QwtMetricsMap::isIdentity(), QwtMetricsMap::layoutToDevice(), QwtMetricsMap::layoutToDeviceX(), QwtMetricsMap::layoutToDeviceY(), QwtAbstractScaleDraw::map(), QwtPainter::metricsMap(), orientation(), pos(), QwtPainter::resetMetricsMap(), and QwtAbstractScaleDraw::scaleMap(). | 
| 
 | ||||||||||||
| 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. 
 
 
 Implements QwtAbstractScaleDraw. Definition at line 280 of file qwt_scale_draw.cpp. References QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), maxLabelHeight(), maxLabelWidth(), QwtAbstractScaleDraw::minimumExtent(), orientation(), and QwtAbstractScaleDraw::spacing(). Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint(). | 
| 
 | ||||||||||||||||
| Determine the minimum border distance. This member function returns the minimum space needed to draw the mark labels at the scale's endpoints. 
 
 Definition at line 139 of file qwt_scale_draw.cpp. References QwtAbstractScaleDraw::hasComponent(), labelRect(), QwtAbstractScaleDraw::map(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks(). Referenced by QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), QwtSlider::minimumSizeHint(), and minLength(). | 
| 
 | 
| 
 
 
 Definition at line 834 of file qwt_scale_draw.cpp. Referenced by labelMatrix(). | 
| 
 | ||||||||||||
| Calculate the matrix that is needed to paint a label depending on its alignment and rotation. 
 
 
 Definition at line 646 of file qwt_scale_draw.cpp. References alignment(), labelAlignment(), and labelRotation(). Referenced by drawLabel(). | 
| 
 | 
| 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() 
 
 Definition at line 356 of file qwt_scale_draw.cpp. References alignment(), QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), QwtAbstractScaleDraw::map(), QwtAbstractScaleDraw::spacing(), and QwtScaleMap::transform(). Referenced by drawLabel(), and labelRect(). | 
| 
 | ||||||||||||
| 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. 
 
 Definition at line 717 of file qwt_scale_draw.cpp. References QwtText::isEmpty(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel(). Referenced by getBorderDistHint(), labelSize(), and minLabelDist(). | 
| 
 | 
| 
 
 
 Definition at line 788 of file qwt_scale_draw.cpp. Referenced by labelMatrix(). | 
| 
 | ||||||||||||
| Calculate the size that is needed to draw a label 
 
 Definition at line 761 of file qwt_scale_draw.cpp. References labelRect(). Referenced by drawLabel(), labelRect(), maxLabelHeight(), and maxLabelWidth(). | 
| 
 | 
| 
 
 
 Definition at line 599 of file qwt_scale_draw.cpp. | 
| 
 | 
| 
 
 
 Definition at line 867 of file qwt_scale_draw.cpp. References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks(). Referenced by extent(). | 
| 
 | 
| 
 
 
 Definition at line 844 of file qwt_scale_draw.cpp. References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks(). Referenced by extent(). | 
| 
 | 
| Determine the minimum distance between two labels, that is necessary that the texts don't overlap. 
 
 
 
 Definition at line 192 of file qwt_scale_draw.cpp. References QwtAbstractScaleDraw::hasComponent(), labelRect(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks(). Referenced by minLength(). | 
| 
 | ||||||||||||
| Calculate the minimum length that is needed to draw the scale 
 
 
 Definition at line 318 of file qwt_scale_draw.cpp. References getBorderDistHint(), QwtAbstractScaleDraw::hasComponent(), minLabelDist(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks(). Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint(). | 
| 
 | 
| Move the position of the scale. The meaning of the parameter pos depends on the alignment: 
 
 
 
 Definition at line 566 of file qwt_scale_draw.cpp. | 
| 
 | 
| Assignment operator. 
 Definition at line 80 of file qwt_scale_draw.cpp. References d_data. | 
| 
 | 
| Return the orientation TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales. 
 
 Definition at line 115 of file qwt_scale_draw.cpp. Referenced by QwtScaleWidget::drawColorBar(), drawTick(), extent(), getBorderDistHint(), minLabelDist(), and QwtPlot::printScale(). | 
| 
 | 
| 
 
 Definition at line 576 of file qwt_scale_draw.cpp. Referenced by drawBackbone(), drawLabel(), drawTick(), and labelRect(). | 
| 
 | 
| Set the alignment of the scale The default alignment is QwtScaleDraw::BottomScale 
 Definition at line 102 of file qwt_scale_draw.cpp. Referenced by QwtThermo::layoutThermo(), and QwtScaleWidget::setScaleDraw(). | 
| 
 | 
| 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 Changing the alignment is often necessary for rotated labels. 
 
 
 
 Definition at line 821 of file qwt_scale_draw.cpp. | 
| 
 | 
| 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. 
 
 
 Definition at line 779 of file qwt_scale_draw.cpp. | 
| 
 | 
| Set the length of the backbone. The length doesn't include the space needed for overlapping labels. 
 
 Definition at line 589 of file qwt_scale_draw.cpp. Referenced by QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), and QwtScaleDraw(). | 
 1.4.6
 1.4.6