Qwt User's Guide
6.0.2
|
#include <qwt_dial.h>
Public Types | |
enum | Direction { Clockwise, CounterClockwise } |
enum | Mode { RotateNeedle, RotateScale } |
enum | Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken } |
![]() | |
enum | ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage } |
Public Member Functions | |
QwtDial (QWidget *parent=NULL) | |
virtual | ~QwtDial () |
QRectF | boundingRect () const |
Direction | direction () const |
Shadow | frameShadow () const |
QRectF | innerRect () const |
int | lineWidth () const |
double | maxScaleArc () const |
virtual QSize | minimumSizeHint () const |
double | minScaleArc () const |
Mode | mode () const |
const QwtDialNeedle * | needle () const |
QwtDialNeedle * | needle () |
double | origin () const |
QwtDialScaleDraw * | scaleDraw () |
const QwtDialScaleDraw * | scaleDraw () const |
virtual QRectF | scaleInnerRect () const |
void | setDirection (Direction) |
void | setFrameShadow (Shadow) |
void | setLineWidth (int) |
void | setMode (Mode) |
virtual void | setNeedle (QwtDialNeedle *) |
virtual void | setOrigin (double) |
virtual void | setScale (int maxMajIntv, int maxMinIntv, double step=0.0) |
void | setScaleArc (double min, double max) |
void | setScaleComponents (QwtAbstractScaleDraw::ScaleComponents) |
virtual void | setScaleDraw (QwtDialScaleDraw *) |
void | setScaleTicks (int minLen, int medLen, int majLen, int penWidth=1) |
virtual void | setWrapping (bool) |
virtual QSize | sizeHint () const |
bool | wrapping () const |
![]() | |
QwtAbstractSlider (Qt::Orientation, QWidget *parent=NULL) | |
virtual | ~QwtAbstractSlider () |
bool | isReadOnly () const |
bool | isValid () const |
virtual double | mass () const |
Qt::Orientation | orientation () const |
virtual void | setMass (double val) |
virtual void | setOrientation (Qt::Orientation o) |
void | setTracking (bool enable) |
void | setUpdateTime (int t) |
void | setValid (bool valid) |
void | stopMoving () |
![]() | |
QwtDoubleRange () | |
virtual | ~QwtDoubleRange () |
virtual void | incPages (int) |
double | maxValue () const |
double | minValue () const |
int | pageSize () const |
bool | periodic () const |
void | setPeriodic (bool tf) |
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1) |
void | setStep (double) |
double | step () const |
double | value () const |
Protected Member Functions | |
virtual void | drawContents (QPainter *) const |
virtual void | drawFocusIndicator (QPainter *) const |
virtual void | drawFrame (QPainter *p) |
virtual void | drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const |
virtual void | drawScale (QPainter *, const QPointF ¢er, double radius, double origin, double arcMin, double arcMax) const |
virtual void | drawScaleContents (QPainter *painter, const QPointF ¢er, double radius) const |
virtual void | getScrollMode (const QPoint &, QwtAbstractSlider::ScrollMode &, int &direction) const |
virtual double | getValue (const QPoint &) |
virtual void | keyPressEvent (QKeyEvent *) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | rangeChange () |
virtual QwtText | scaleLabel (double) const |
void | updateScale () |
virtual void | valueChange () |
![]() | |
virtual void | mouseMoveEvent (QMouseEvent *e) |
double | mouseOffset () const |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
int | scrollMode () const |
void | setMouseOffset (double) |
virtual void | setPosition (const QPoint &) |
virtual void | timerEvent (QTimerEvent *e) |
virtual void | wheelEvent (QWheelEvent *e) |
![]() | |
double | exactPrevValue () const |
double | exactValue () const |
double | prevValue () const |
virtual void | stepChange () |
Friends | |
class | QwtDialScaleDraw |
Additional Inherited Members | |
![]() | |
virtual void | fitValue (double val) |
virtual void | incValue (int steps) |
virtual void | setReadOnly (bool) |
virtual void | setValue (double val) |
![]() | |
void | sliderMoved (double value) |
void | sliderPressed () |
void | sliderReleased () |
void | valueChanged (double value) |
QwtDial class provides a rounded range control.
QwtDial is intended as base class for dial widgets like speedometers, compass widgets, clocks ...
A dial contains a scale and a needle indicating the current value of the dial. Depending on Mode one of them is fixed and the other is rotating. If not isReadOnly() the dial can be rotated by dragging the mouse or using keyboard inputs (see keyPressEvent()). A dial might be wrapping, what means a rotation below/above one limit continues on the other limit (f.e compass). The scale might cover any arc of the dial, its values are related to the origin() of the dial.
Qwt is missing a set of good looking needles (QwtDialNeedle). Contributions are very welcome.
enum QwtDial::Direction |
enum QwtDial::Mode |
enum QwtDial::Shadow |
|
explicit |
Constructor.
parent | Parent widget |
Create a dial widget with no scale and no needle. The default origin is 90.0 with no valid value. It accepts mouse and keyboard inputs and has no step size. The default mode is QwtDial::RotateNeedle.
QRectF QwtDial::boundingRect | ( | ) | const |
QwtDial::Direction QwtDial::direction | ( | ) | const |
The default direction of a dial is QwtDial::Clockwise
|
protectedvirtual |
Draw the contents inside the frame.
QPalette::Window is the background color outside of the frame. QPalette::Base is the background color inside the frame. QPalette::WindowText is the background color inside the scale.
painter | Painter |
|
protectedvirtual |
Draw a dotted round circle, if !isReadOnly()
painter | Painter |
|
protectedvirtual |
|
protectedvirtual |
Draw the needle
painter | Painter |
center | Center of the dial |
radius | Length for the needle |
direction | Direction of the needle in degrees, counter clockwise |
cg | ColorGroup |
Reimplemented in QwtAnalogClock.
|
protectedvirtual |
Draw the scale
painter | Painter |
center | Center of the dial |
radius | Radius of the scale |
origin | Origin of the scale |
minArc | Minimum of the arc |
maxArc | Minimum of the arc |
|
protectedvirtual |
Draw the contents inside the scale
Paints nothing.
painter | Painter |
center | Center of the contents circle |
radius | Radius of the contents circle |
Reimplemented in QwtCompass.
QwtDial::Shadow QwtDial::frameShadow | ( | ) | const |
|
protectedvirtual |
See QwtAbstractSlider::getScrollMode()
pos | point where the mouse was pressed |
scrollMode | The scrolling mode |
direction | direction: 1, 0, or -1. |
Implements QwtAbstractSlider.
|
protectedvirtual |
Find the value for a given position
pos | Position |
Implements QwtAbstractSlider.
QRectF QwtDial::innerRect | ( | ) | const |
|
protectedvirtual |
Handles key events
event | Key event |
Reimplemented from QwtAbstractSlider.
Reimplemented in QwtCompass.
int QwtDial::lineWidth | ( | ) | const |
double QwtDial::maxScaleArc | ( | ) | const |
|
virtual |
Return a minimum size hint.
double QwtDial::minScaleArc | ( | ) | const |
QwtDial::Mode QwtDial::mode | ( | ) | const |
The value of the dial is indicated by the difference between the origin and the direction of the needle. In case of QwtDial::RotateNeedle the scale arc is fixed to the origin() and the needle is rotating, in case of QwtDial::RotateScale, the needle points to origin() and the scale is rotating.
The default mode is QwtDial::RotateNeedle.
const QwtDialNeedle * QwtDial::needle | ( | ) | const |
QwtDialNeedle * QwtDial::needle | ( | ) |
double QwtDial::origin | ( | ) | const |
The origin is the angle where scale and needle is relative to.
|
protectedvirtual |
Paint the dial
event | Paint event |
|
virtual |
|
protectedvirtual |
Find the label for a value
value | Value |
Reimplemented in QwtAnalogClock, and QwtCompass.
void QwtDial::setDirection | ( | Direction | direction | ) |
Set the direction of the dial (clockwise/counterclockwise)
direction | Direction |
void QwtDial::setFrameShadow | ( | Shadow | shadow | ) |
Sets the frame shadow value from the frame style.
shadow | Frame shadow |
void QwtDial::setLineWidth | ( | int | lineWidth | ) |
void QwtDial::setMode | ( | Mode | mode | ) |
Change the mode of the meter.
mode | New mode |
The value of the meter is indicated by the difference between north of the scale and the direction of the needle. In case of QwtDial::RotateNeedle north is pointing to the origin() and the needle is rotating, in case of QwtDial::RotateScale, the needle points to origin() and the scale is rotating.
The default mode is QwtDial::RotateNeedle.
|
virtual |
Set a needle for the dial
Qwt is missing a set of good looking needles. Contributions are very welcome.
needle | Needle |
|
virtual |
Change the origin.
The origin is the angle where scale and needle is relative to.
origin | New origin |
|
virtual |
Change the intervals of the scale
maxMajIntv | Maximum for the number of major steps |
maxMinIntv | Maximum number of minor steps |
step | Step size |
void QwtDial::setScaleArc | ( | double | minArc, |
double | maxArc | ||
) |
Change the arc of the scale
minArc | Lower limit |
maxArc | Upper limit |
void QwtDial::setScaleComponents | ( | QwtAbstractScaleDraw::ScaleComponents | components | ) |
A wrapper method for accessing the scale draw.
components | Scale components |
|
virtual |
Set an individual scale draw
scaleDraw | Scale draw |
void QwtDial::setScaleTicks | ( | int | minLen, |
int | medLen, | ||
int | majLen, | ||
int | penWidth = 1 |
||
) |
Assign length and width of the ticks
minLen | Length of the minor ticks |
medLen | Length of the medium ticks |
majLen | Length of the major ticks |
penWidth | Width of the pen for all ticks |
|
virtual |
Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to on.
wrapping | en/disables wrapping |
|
virtual |
|
protected |
Update the scale with the current attributes
bool QwtDial::wrapping | ( | ) | const |
wrapping() holds whether it is possible to step the value from the highest value to the lowest value and vice versa.