Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
QwtScaleDraw Class Reference
A class for drawing scales.
More...
#include <qwt_scldraw.h>
Inherits QwtDiMap.
Inheritance diagram for QwtScaleDraw
[legend]List of all members.
Public Types |
enum | Orientation {
Bottom,
Top,
Left,
Right,
Round
} |
Public Methods |
| QwtScaleDraw () |
void | setScale (const QwtScaleDiv &s) |
void | setScale (double vmin, double vmax, int maxMajIntv, int maxMinIntv, double step = 0.0, int logarithmic = 0) |
void | setGeometry (int xorigin, int yorigin, int length, Orientation o) |
void | setAngleRange (double angle1, double angle2) |
void | setLabelFormat (char f, int prec) |
const QwtScaleDiv& | scaleDiv () const |
Orientation | orientation () const |
QRect | maxBoundingRect (QPainter *p) const |
int | maxWidth (QPainter *p, bool worst = TRUE) const |
int | maxHeight (QPainter *p) const |
int | maxLabelWidth (QPainter *p, int worst = TRUE) const |
void | labelFormat (char &f, int &prec) const |
void | draw (QPainter *p) const |
Detailed Description
A class for drawing scales.
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 setGeometry().
After a scale division has been specified as a QwtScaleDiv object using setScale(const QwtScaleDiv &s), or determined internally using setScale(double vmin, double vmax, int maxMajIntv, int maxMinIntv, double step = 0.0, int logarithmic = 0), the scale can be drawn with the QwtScaleDiv::draw() member.
Constructor & Destructor Documentation
QwtScaleDraw::QwtScaleDraw (
|
)
|
|
|
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. |
Member Function Documentation
void QwtScaleDraw::draw (
|
QPainter * p ) const
|
|
|
Draw the scale.
-
Parameters:
-
|
void QwtScaleDraw::labelFormat (
|
char & f,
|
|
int & prec ) const
|
|
|
Format character and precision have the same meaning as for the QString class. -
Return values:
-
-
Returns:
-
the number format for the major scale labels
-
See also:
-
QString::setNum in the Qt manual
|
QRect QwtScaleDraw::maxBoundingRect (
|
QPainter * p ) const
|
|
|
The bounding rectangle is not very exact for round scales with strange angle ranges. -
Parameters:
-
-
Returns:
-
the maximum bounding rectangle of the scale for a specified painter
|
int QwtScaleDraw::maxHeight (
|
QPainter * p ) const
|
|
|
-
Parameters:
-
-
Returns:
-
the maximum height of the scale for the specified painter
|
int QwtScaleDraw::maxLabelWidth (
|
QPainter * p,
|
|
int worst = TRUE ) const
|
|
|
-
Parameters:
-
p
|
painter |
worst
|
If TRUE , take the worst case. If FALSE , take the actual width of the largest label. |
-
Returns:
-
the maximum width of a label
|
int QwtScaleDraw::maxWidth (
|
QPainter * p,
|
|
bool worst = TRUE ) const
|
|
|
-
Parameters:
-
p
|
painter |
worst
|
if TRUE , assume the worst possible case. If FALSE , calculate the real maximum width, which is more CPU intensive. |
-
Returns:
-
the maximum width of the scale for a specified QPainter
|
Orientation QwtScaleDraw::orientation (
|
) const
|
|
|
-
Returns:
-
scale orientation
|
void QwtScaleDraw::setAngleRange (
|
double angle1,
|
|
double angle2 )
|
|
|
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. -
Parameters:
-
angle1
|
|
angle2
|
boundaries of the angle interval in degrees. |
-
Warning:
-
- The angle range is limited to [-360, 360] degrees. Angles exceeding this range will be clipped.
- For angles more than 359 degrees above or below min(angle1, angle2), scale marks will not be drawn.
- If you need a counterclockwise scale, use QwtScaleDiv::setRange
|
void QwtScaleDraw::setGeometry (
|
int xorigin,
|
|
int yorigin,
|
|
int length,
|
|
Orientation o )
|
|
|
Specify the geometry of the scale.
The parameters xorigin, yorigin and length have different meanings, dependent on the orientation:
- QwtScaleDraw::Left
- The origin is the topmost point of the baseline. The baseline is a vertical line with the specified length. Scale marks and labels are drawn at the left of the baseline.
- QwtScaleDraw::Right
- The origin is the topmost point of the baseline. The baseline is a vertical line with the specified length. Scale marks and labels are drawn at the right of the baseline.
- QwtScaleDraw::Top
- The origin is the leftmost point of the baseline. The baseline is a horizontal line with the specified length. Scale marks and labels are drawn above the baseline.
- QwtScaleDraw::Bottom
- The origin is the leftmost point of the baseline. The baseline is a horizontal line with the specified length. Scale marks and labels are drawn below the baseline.
- QwtScaleDraw::Round
- The origin is the top left corner of the bounding rectangle of the baseline circle. The baseline is the segment of a circle with a diameter of the specified length. Scale marks and labels are drawn outside the baseline circle.
-
Parameters:
-
xorigin
|
x coordinate of the origin |
yorigin
|
y coordinate of the origin |
length
|
length or diameter of the scale |
o
|
The orientation |
|
void QwtScaleDraw::setLabelFormat (
|
char f,
|
|
int prec )
|
|
|
Set the number format for the major scale labels.
Format character and precision have the same meaning as for the QString class. -
Parameters:
-
f
|
format character |
prec
|
precision |
-
See also:
-
QString::setNum in the Qt manual
|
void QwtScaleDraw::setScale (
|
double x1,
|
|
double x2,
|
|
int maxMajIntv,
|
|
int maxMinIntv,
|
|
double step = 0.0,
|
|
int logscale = 0 )
|
|
|
Adjust the range of the scale.
If step == 0.0, the step width is calculated automatically dependent on the maximal number of scale ticks. -
Parameters:
-
x1
|
value at the left/low endpoint of the scale |
x2
|
value at the right/high endpoint of the scale |
step
|
step size (default : 0.0) |
logscale
|
logarithmic scale (default : 0) |
|
|
Change the scale division.
-
Parameters:
-
|
The documentation for this class was generated from the following files:
- qwt_scldraw.h
- qwt_scldraw.cpp
Generated at Thu Dec 14 00:27:20 2000 for Qwt User's Guide by
1.2.3 written by Dimitri van Heesch,
© 1997-2000