QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
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 37 of file qwt_abstract_scale_draw.h.
Public Types | |
enum | ScaleComponent { Backbone = 1, Ticks = 2, Labels = 4 } |
Public Member Functions | |
QwtAbstractScaleDraw () | |
QwtAbstractScaleDraw (const QwtAbstractScaleDraw &) | |
virtual | ~QwtAbstractScaleDraw () |
QwtAbstractScaleDraw & | operator= (const QwtAbstractScaleDraw &) |
void | setScaleDiv (const QwtScaleDiv &s) |
const QwtScaleDiv & | scaleDiv () const |
void | setTransformation (const QwtScaleTransformation &) |
const QwtScaleMap & | map () const |
void | enableComponent (ScaleComponent, bool enable=true) |
bool | hasComponent (ScaleComponent) const |
void | setTickLength (QwtScaleDiv::TickType, int length) |
int | tickLength (QwtScaleDiv::TickType) const |
int | majTickLength () const |
void | setSpacing (int margin) |
int | spacing () const |
virtual void | draw (QPainter *, const QColorGroup &) const |
virtual QwtText | label (double) const |
virtual int | extent (const QPen &, const QFont &) const =0 |
void | setMinimumExtent (int) |
int | minimumExtent () const |
Protected Member Functions | |
virtual void | drawTick (QPainter *painter, double value, int len) const =0 |
virtual void | drawBackbone (QPainter *painter) const =0 |
virtual void | drawLabel (QPainter *painter, double value) const =0 |
QwtScaleMap & | scaleMap () |
void | invalidateCache () |
const QwtText & | tickLabel (const QFont &, double value) const |
|
Definition at line 41 of file qwt_abstract_scale_draw.h. |
|
Constructor. The range of the scale is initialized to [0, 100], The spacing (distance between ticks and labels) is set to 4, the tick lengths are set to 4,6 and 8 pixels Definition at line 54 of file qwt_abstract_scale_draw.cpp. |
|
Copy constructor.
Definition at line 60 of file qwt_abstract_scale_draw.cpp. References d_data. |
|
Destructor.
Definition at line 66 of file qwt_abstract_scale_draw.cpp. |
|
Draw the scale.
Definition at line 147 of file qwt_abstract_scale_draw.cpp. References Backbone. Referenced by QwtThermo::draw(), QwtSlider::draw(), QwtKnob::draw(), and QwtPlot::printScale(). |
|
Draws the baseline of the scale
Implemented in QwtRoundScaleDraw, and QwtScaleDraw. |
|
Draws the label for a major scale tick
Implemented in QwtRoundScaleDraw, and QwtScaleDraw. |
|
Draw a tick
Implemented in QwtRoundScaleDraw, and QwtScaleDraw. |
|
En/Disable a component of the scale
Definition at line 81 of file qwt_abstract_scale_draw.cpp. Referenced by QwtDial::setScaleOptions(). |
|
Calculate the extent The extent is the distcance from the baseline to the outermost pixel of the scale draw in opposite to its orienatation. It is at least minimumExtent() pixels.
Implemented in QwtRoundScaleDraw, and QwtScaleDraw. |
|
Check if a component is enabled Definition at line 94 of file qwt_abstract_scale_draw.cpp. Referenced by QwtScaleDraw::extent(), QwtRoundScaleDraw::extent(), QwtScaleDraw::getBorderDistHint(), QwtRoundScaleDraw::labelCenter(), QwtScaleDraw::labelPosition(), QwtPlotLayout::minimumSizeHint(), QwtScaleDraw::minLabelDist(), and QwtScaleDraw::minLength(). |
|
Invalidate the cache used by QwtAbstractScaleDraw::tickLabel The cache is invalidated, when a new QwtScaleDiv is set. If the labels need to be changed. while the same QwtScaleDiv is set, QwtAbstractScaleDraw::invalidateCache needs to be called manually. Definition at line 394 of file qwt_abstract_scale_draw.cpp. |
|
Convert a value into its representing label. The value is converted to a plain text using QString::number(value). This method is often overloaded by applications to have individual labels.
Reimplemented in QwtDialScaleDraw. Definition at line 355 of file qwt_abstract_scale_draw.cpp. Referenced by QwtRoundScaleDraw::drawLabel(), QwtDialScaleDraw::label(), QwtRoundScaleDraw::labelRect(), and tickLabel(). |
|
The same as QwtAbstractScaleDraw::tickLength(QwtScaleDiv::MajorTick). Definition at line 340 of file qwt_abstract_scale_draw.cpp. Referenced by QwtScaleDraw::extent(), QwtRoundScaleDraw::extent(), QwtRoundScaleDraw::labelCenter(), QwtScaleDraw::labelPosition(), and QwtPlotLayout::minimumSizeHint(). |
|
Definition at line 121 of file qwt_abstract_scale_draw.cpp. Referenced by QwtRoundScaleDraw::drawBackbone(), QwtRoundScaleDraw::drawLabel(), QwtScaleDraw::drawTick(), QwtRoundScaleDraw::drawTick(), QwtScaleDraw::getBorderDistHint(), QwtScaleDraw::labelPosition(), and QwtRoundScaleDraw::labelRect(). |
|
Get the minimum extent
Definition at line 288 of file qwt_abstract_scale_draw.cpp. Referenced by QwtScaleDraw::extent(), and QwtRoundScaleDraw::extent(). |
|
Assignment operator.
Definition at line 71 of file qwt_abstract_scale_draw.cpp. References d_data. |
|
Definition at line 133 of file qwt_abstract_scale_draw.cpp. Referenced by QwtRoundScaleDraw::extent(), QwtScaleDraw::getBorderDistHint(), QwtScaleDraw::maxLabelHeight(), QwtScaleDraw::maxLabelWidth(), QwtScaleDraw::minLabelDist(), QwtScaleDraw::minLength(), and QwtPlot::sizeHint(). |
|
Definition at line 127 of file qwt_abstract_scale_draw.cpp. Referenced by QwtRoundScaleDraw::QwtRoundScaleDraw(), and QwtRoundScaleDraw::setAngleRange(). |
|
Set a minimum for the extent. The extent is calculated from the coomponents of the scale draw. In situations, where the labels are changing and the layout depends on the extent (f.e scrolling a scale), setting an upper limit as minimum extent will avoid jumps of the layout.
Definition at line 276 of file qwt_abstract_scale_draw.cpp. |
|
Change the scale division
Definition at line 103 of file qwt_abstract_scale_draw.cpp. References QwtScaleDiv::hBound(), and QwtScaleDiv::lBound(). |
|
Set the spacing between tick and labels. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
Definition at line 242 of file qwt_abstract_scale_draw.cpp. |
|
Set the length of the ticks
Definition at line 301 of file qwt_abstract_scale_draw.cpp. Referenced by QwtDial::setScaleTicks(). |
|
Change the transformation of the scale
Definition at line 114 of file qwt_abstract_scale_draw.cpp. |
|
Get the spacing. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
Definition at line 258 of file qwt_abstract_scale_draw.cpp. Referenced by QwtScaleDraw::extent(), QwtRoundScaleDraw::labelCenter(), and QwtScaleDraw::labelPosition(). |
|
Convert a value into its representing label and cache it. The conversion between value and label is called very often in the layout and painting code. Also the calculation of the label sizes might be slow (really slow for rich text in Qt4). QwtAbstractScaleDraw::tickLabel calls QwtAbstractScaleDraw::label and caches its result. Definition at line 369 of file qwt_abstract_scale_draw.cpp. References label(), QwtText::setFlags(), QwtText::setLayoutAttributes(), and QwtText::textSize(). Referenced by QwtScaleDraw::drawLabel(), QwtRoundScaleDraw::drawLabel(), QwtScaleDraw::labelRect(), QwtRoundScaleDraw::labelRect(), and QwtRoundScaleDraw::labelSize(). |
|
Return the length of the ticks
Definition at line 326 of file qwt_abstract_scale_draw.cpp. |