Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtDial Class Reference

#include <qwt_dial.h>

Inheritance diagram for QwtDial:

QwtSliderBase QwtDblRange QwtCompass List of all members.

Public Types

enum  Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken }
enum  Mode { RotateNeedle, RotateScale }

Public Member Functions

 QwtDial (QWidget *parent=0, const char *name=0)
virtual ~QwtDial ()
void setFrameShadow (Shadow)
Shadow frameShadow () const
bool hasVisibleBackground () const
void showBackground (bool)
void setLineWidth (int)
int lineWidth () const
void setMode (Mode)
Mode mode () const
void setWrapping (bool)
bool wrapping () const
void setScale (int maxMajIntv, int maxMinIntv, double step=0.0)
void setScaleArc (double min, double max)
double minScaleArc () const
double maxScaleArc () const
void setOrigin (double)
double origin () const
void setNeedle (QwtDialNeedle *)
const QwtDialNeedleneedle () const
QwtDialNeedleneedle ()
QRect boundingRect () const
QRect contentsRect () const
virtual QRect scaleContentsRect () const
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const

Protected Member Functions

virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)
virtual void drawFrame (QPainter *p)
virtual void drawContents (QPainter *) const
virtual void drawScale (QPainter *, const QPoint &center, int radius, double origin, double arcMin, double arcMax) const
virtual void drawScaleContents (QPainter *, const QPoint &center, int radius) const
virtual void drawNeedle (QPainter *, const QPoint &, int radius, double direction, QPalette::ColorGroup) const
virtual void setScaleDraw (QwtDialScaleDraw *)
QwtDialScaleDrawscaleDraw ()
const QwtDialScaleDrawscaleDraw () const
virtual QString scaleLabel (double) const
void updateScale ()
virtual void rangeChange ()
virtual void valueChange ()
virtual double getValue (const QPoint &)
virtual void getScrollMode (const QPoint &, int &scrollMode, int &direction)

Private Attributes

Q_OBJECT friend class QwtDialScaleDraw
bool d_visibleBackground
Shadow d_frameShadow
int d_lineWidth
Mode d_mode
bool d_wrapping
double d_origin
double d_minScaleArc
double d_maxScaleArc
QwtDialScaleDrawd_scaleDraw
int d_maxMajIntv
int d_maxMinIntv
double d_scaleStep
QwtDialNeedled_needle

Member Enumeration Documentation

enum QwtDial::Mode
 

Enumeration values:
RotateNeedle  In case of RotateNeedle the needle is rotating, in case of RotateScale, the needle points to origin() and the scale is rotating.
RotateScale 

Definition at line 64 of file qwt_dial.h.

Referenced by mode().

enum QwtDial::Shadow
 

Enumeration values:
Plain  Frame shadow.

Unfortunately it is not possible to use QFrame::Shadow as a property of a widget that is not derived from QFrame The following enum is made for the designer only. It is safe to use QFrame::Shadow instead.

Raised 
Sunken 

Definition at line 48 of file qwt_dial.h.

Referenced by frameShadow().


Constructor & Destructor Documentation

QwtDial::QwtDial QWidget *  parent = 0,
const char *  name = 0
 

Constructor.

Parameters:
parent Parent widget
name Widget name
Create a dial 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.

Definition at line 44 of file qwt_dial.cpp.

References d_scaleDraw, QwtDialScaleDraw, QwtScaleDraw::Round, QwtScaleDraw::setGeometry(), QwtDblRange::setRange(), and setScaleArc().

QwtDial::~QwtDial  )  [virtual]
 

Destructor.

Definition at line 84 of file qwt_dial.cpp.

References d_needle, and d_scaleDraw.


Member Function Documentation

QRect QwtDial::boundingRect  )  const
 

Returns:
bounding rect of the compass circle including the frame
See also:
QwtDial::setLineWidth, QwtDial::scaleContentsRect, QwtDial::contentsRect

Definition at line 209 of file qwt_dial.cpp.

Referenced by contentsRect(), drawFrame(), resizeEvent(), and showBackground().

QRect QwtDial::contentsRect  )  const
 

Returns:
bounding rect of the compass circle without the frame
See also:
QwtDial::setLineWidth, QwtDial::scaleContentsRect, QwtDial::boundingRect

Definition at line 191 of file qwt_dial.cpp.

References boundingRect(), and lineWidth().

Referenced by drawContents(), getScrollMode(), paintEvent(), and scaleContentsRect().

void QwtDial::drawContents QPainter *  painter  )  const [protected, virtual]
 

Draw the contents inside of the frame.

QColorGroup::Backgound is the background color outside of the frame. QColorGroup::Base is the background color inside the frame. QColorGroup::Foreground is the background color inside the scale.

Parameters:
painter Painter
See also:
QwtDial::boundingRect, QwtDial::contentsRect, QwtDial::scaleContentsRect, QWidget::setPalette

Definition at line 390 of file qwt_dial.cpp.

References contentsRect(), d_maxScaleArc, d_minScaleArc, d_origin, drawNeedle(), drawScale(), drawScaleContents(), QwtDblRange::isValid(), QwtDblRange::maxValue(), QwtDblRange::minValue(), mode(), origin(), RotateScale, scaleContentsRect(), and QwtDblRange::value().

Referenced by paintEvent().

void QwtDial::drawFrame QPainter *  painter  )  [protected, virtual]
 

Draw the compass frame

Parameters:
painter Painter
See also:
QwtDial::lineWidth, QwtDial::frameShadow

Definition at line 351 of file qwt_dial.cpp.

References boundingRect(), d_frameShadow, QwtPainter::drawRoundFrame(), and lineWidth().

Referenced by paintEvent().

void QwtDial::drawNeedle QPainter *  painter,
const QPoint &  center,
int  radius,
double  direction,
QPalette::ColorGroup  cg
const [protected, virtual]
 

Draw the needle

Parameters:
painter Painter
center Center of the dial
radius Length for the needle
direction Direction of the needle in degrees, counter clockwise
cg ColorGroup

Definition at line 475 of file qwt_dial.cpp.

References d_needle, and QwtDialNeedle::draw().

Referenced by drawContents().

void QwtDial::drawScale QPainter *  ,
const QPoint &  center,
int  radius,
double  origin,
double  arcMin,
double  arcMax
const [protected, virtual]
 

Definition at line 485 of file qwt_dial.cpp.

References d_scaleDraw, QwtScaleDraw::draw(), QwtScaleDraw::Round, QwtScaleDraw::setAngleRange(), and QwtScaleDraw::setGeometry().

Referenced by drawContents().

void QwtDial::drawScaleContents QPainter *  ,
const QPoint &  center,
int  radius
const [protected, virtual]
 

Draw the contents inside the scale

Parameters:
painter Painter
center Center of the contents circle
radius Radius of the contents circle

Reimplemented in QwtCompass.

Definition at line 527 of file qwt_dial.cpp.

Referenced by drawContents().

QwtDial::Shadow QwtDial::frameShadow  )  const
 

Returns:
Frame shadow /sa QwtDial::setFrameShadow, QwtDial::lineWidth, QFrame::frameShadow

Definition at line 153 of file qwt_dial.cpp.

References d_frameShadow, and Shadow.

void QwtDial::getScrollMode const QPoint &  ,
int &  scrollMode,
int &  direction
[protected, virtual]
 

Determine what to do when the user presses a mouse button.

This function is abstract and has to be implemented by derived classes. It is called on a mousePress event. The derived class can determine what should happen next in dependence of the position where the mouse was pressed by returning scrolling mode and direction. QwtSliderBase knows the following modes:

QwtSliderBase::ScrNone
Scrolling switched off. Don't change the value.
QwtSliderBase::ScrMouse
Change the value while the user keeps the button pressed and moves the mouse.
QwtSliderBase::ScrTimer
Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.
QwtSliderBase::ScrPage
Automatic scrolling. Same as ScrTimer, but increment by page size.

Parameters:
p point where the mouse was pressed
Return values:
scrollMode The scrolling mode
direction direction: 1, 0, or -1.

Implements QwtSliderBase.

Definition at line 736 of file qwt_dial.cpp.

References contentsRect(), QwtSliderBase::ScrMouse, and QwtSliderBase::ScrNone.

double QwtDial::getValue const QPoint &   )  [protected, virtual]
 

Determine the value corresponding to a specified poind.

This is an abstract virtual function which is called when the user presses or releases a mouse button or moves the mouse. It has to be implemented by the derived class.

Parameters:
p point

Implements QwtSliderBase.

Definition at line 703 of file qwt_dial.cpp.

References d_maxScaleArc, d_minScaleArc, QwtSliderBase::d_mouseOffset, d_origin, QwtSliderBase::d_scrollMode, line2Radians(), QwtDblRange::maxValue(), QwtDblRange::minValue(), mode(), RotateScale, QwtSliderBase::ScrMouse, and QwtDblRange::value().

bool QwtDial::hasVisibleBackground  )  const
 

TRUE when the area outside of the compass frame is visible

See also:
QwtDial::showBackground, QWidget::setMask

Definition at line 126 of file qwt_dial.cpp.

References d_visibleBackground.

Referenced by resizeEvent().

int QwtDial::lineWidth  )  const
 

Returns:
Line width of the frame
See also:
QwtDial::setLineWidth, QwtDial::frameShadow, QFrame::lineWidth

Definition at line 181 of file qwt_dial.cpp.

References d_lineWidth.

Referenced by contentsRect(), drawFrame(), minimumSizeHint(), setFrameShadow(), and sizeHint().

double QwtDial::maxScaleArc  )  const [inline]
 

Definition at line 98 of file qwt_dial.h.

QSize QwtDial::minimumSizeHint  )  const [virtual]
 

Return a minimum size hint.

Warning:
The return value of QwtDial::minimumSizeHint() depends on the font and the scale.

Definition at line 674 of file qwt_dial.cpp.

References d_scaleDraw, lineWidth(), and QwtScaleDraw::minHeight().

double QwtDial::minScaleArc  )  const [inline]
 

Definition at line 97 of file qwt_dial.h.

QwtDial::Mode QwtDial::mode  )  const
 

Returns:
mode of the compass.
The value of the compass 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.

See also:
QwtCompass::setMode, QwtDial::origin, QwtDial::value

Definition at line 284 of file qwt_dial.cpp.

References d_mode, and Mode.

Referenced by drawContents(), QwtCompass::drawScaleContents(), getValue(), and QwtCompass::keyPressEvent().

QwtDialNeedle * QwtDial::needle  ) 
 

Returns:
needle
See also:
QwtDial::setNeedle

Definition at line 567 of file qwt_dial.cpp.

References d_needle.

const QwtDialNeedle * QwtDial::needle  )  const
 

Returns:
needle
See also:
QwtDial::setNeedle

Definition at line 557 of file qwt_dial.cpp.

References d_needle.

double QwtDial::origin  )  const
 

Definition at line 627 of file qwt_dial.cpp.

References d_origin.

Referenced by drawContents(), QwtCompass::drawScaleContents(), and QwtCompass::keyPressEvent().

void QwtDial::paintEvent QPaintEvent *   )  [protected, virtual]
 

Repaint the compass.

Definition at line 316 of file qwt_dial.cpp.

References contentsRect(), drawContents(), drawFrame(), and QwtPaintBuffer::painter().

void QwtDial::rangeChange  )  [protected, virtual]
 

Notify a change of the range.

This virtual function is called whenever the range changes. The default implementation does nothing.

Reimplemented from QwtDblRange.

Definition at line 572 of file qwt_dial.cpp.

References updateScale().

void QwtDial::resizeEvent QResizeEvent *   )  [protected, virtual]
 

Resize the compass.

Definition at line 300 of file qwt_dial.cpp.

References boundingRect(), and hasVisibleBackground().

QRect QwtDial::scaleContentsRect  )  const [virtual]
 

Returns:
rect inside the scale
See also:
setLineWidth, QwtDial::boundingRect, QwtDial::contentsRect

Definition at line 230 of file qwt_dial.cpp.

References contentsRect(), d_scaleDraw, QwtScaleDraw::maxHeight(), and QwtScaleDraw::maxWidth().

Referenced by drawContents().

const QwtDialScaleDraw* QwtDial::scaleDraw  )  const [inline, protected]
 

Definition at line 132 of file qwt_dial.h.

QwtDialScaleDraw* QwtDial::scaleDraw  )  [inline, protected]
 

Definition at line 131 of file qwt_dial.h.

Referenced by QwtCompass::QwtCompass().

QString QwtDial::scaleLabel double   )  const [protected, virtual]
 

Reimplemented in QwtCompass.

Definition at line 608 of file qwt_dial.cpp.

Referenced by QwtDialScaleDraw::label().

void QwtDial::setFrameShadow Shadow  shadow  ) 
 

Sets the frame shadow value from the frame style.

Parameters:
shadow Frame shadow
See also:
QwtDial::setLineWidth, QFrame::setFrameShadow

Definition at line 137 of file qwt_dial.cpp.

References d_frameShadow, and lineWidth().

void QwtDial::setLineWidth int  lineWidth  ) 
 

Sets the line width

Parameters:
isVisible Show if TRUE, hide if FALSE
See also:
QwtDial::setFrameShadow

Definition at line 164 of file qwt_dial.cpp.

References d_lineWidth.

void QwtDial::setMode Mode  mode  ) 
 

Change the mode of the meter.

Parameters:
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 QwtCompass::RotateNeedle north is pointing to the origin() and the needle is rotating, in case of QwtCompass::RotateScale, the needle points to origin() and the scale is rotating.

See also:
QwtCompass::mode, QwtDial::setValue, QwtDial::setOrigin

Definition at line 262 of file qwt_dial.cpp.

References d_mode.

void QwtDial::setNeedle QwtDialNeedle needle  ) 
 

Set a needle for the dial

Parameters:
needle Needle
Warning:
The needle will be deleted, when a different needle is set or in ~QwtDial

Definition at line 540 of file qwt_dial.cpp.

References d_needle.

void QwtDial::setOrigin double   ) 
 

Definition at line 621 of file qwt_dial.cpp.

References d_origin.

Referenced by QwtCompass::QwtCompass().

void QwtDial::setScale int  maxMajIntv,
int  maxMinIntv,
double  step = 0.0
 

Definition at line 599 of file qwt_dial.cpp.

References d_maxMajIntv, d_maxMinIntv, d_scaleStep, and updateScale().

void QwtDial::setScaleArc double  min,
double  max
 

Definition at line 632 of file qwt_dial.cpp.

References d_maxScaleArc, and d_minScaleArc.

Referenced by QwtDial().

void QwtDial::setScaleDraw QwtDialScaleDraw  )  [protected, virtual]
 

Definition at line 586 of file qwt_dial.cpp.

References d_scaleDraw, and updateScale().

void QwtDial::setWrapping bool   ) 
 

Definition at line 289 of file qwt_dial.cpp.

References d_wrapping.

Referenced by QwtCompass::QwtCompass().

void QwtDial::showBackground bool  show  ) 
 

Show/Hide the area outside of the compass frame

Parameters:
show Show if TRUE, hide if FALSE
See also:
QwtDial::hasVisibleBackground, QWidget::setMask
Warning:
When QwtDial is a toplevel widget the window border might disappear too.

Definition at line 99 of file qwt_dial.cpp.

References boundingRect(), and d_visibleBackground.

QSize QwtDial::sizeHint  )  const [virtual]
 

Returns:
QwtDial::sizeHint()

Definition at line 658 of file qwt_dial.cpp.

References d_scaleDraw, lineWidth(), and QwtScaleDraw::minHeight().

void QwtDial::updateScale  )  [protected]
 

Definition at line 577 of file qwt_dial.cpp.

References d_maxMajIntv, d_maxMinIntv, d_scaleDraw, d_scaleStep, QwtDblRange::maxValue(), QwtDblRange::minValue(), and QwtScaleDraw::setScale().

Referenced by rangeChange(), setScale(), and setScaleDraw().

void QwtDial::valueChange  )  [protected, virtual]
 

Notify change of value

This function can be reimplemented by derived classes in order to keep track of changes, i.e. repaint the widget. The default implementation emits a valueChanged() signal if tracking is enabled.

Reimplemented from QwtSliderBase.

Definition at line 649 of file qwt_dial.cpp.

References QwtSliderBase::valueChange().

bool QwtDial::wrapping  )  const
 

Definition at line 294 of file qwt_dial.cpp.

References d_wrapping.


Member Data Documentation

Shadow QwtDial::d_frameShadow [private]
 

Definition at line 146 of file qwt_dial.h.

Referenced by drawFrame(), frameShadow(), and setFrameShadow().

int QwtDial::d_lineWidth [private]
 

Definition at line 147 of file qwt_dial.h.

Referenced by lineWidth(), and setLineWidth().

int QwtDial::d_maxMajIntv [private]
 

Definition at line 157 of file qwt_dial.h.

Referenced by setScale(), and updateScale().

int QwtDial::d_maxMinIntv [private]
 

Definition at line 158 of file qwt_dial.h.

Referenced by setScale(), and updateScale().

double QwtDial::d_maxScaleArc [private]
 

Definition at line 154 of file qwt_dial.h.

Referenced by drawContents(), getValue(), and setScaleArc().

double QwtDial::d_minScaleArc [private]
 

Definition at line 153 of file qwt_dial.h.

Referenced by drawContents(), getValue(), and setScaleArc().

Mode QwtDial::d_mode [private]
 

Definition at line 149 of file qwt_dial.h.

Referenced by mode(), and setMode().

QwtDialNeedle* QwtDial::d_needle [private]
 

Definition at line 161 of file qwt_dial.h.

Referenced by drawNeedle(), needle(), setNeedle(), and ~QwtDial().

double QwtDial::d_origin [private]
 

Definition at line 152 of file qwt_dial.h.

Referenced by drawContents(), getValue(), origin(), and setOrigin().

QwtDialScaleDraw* QwtDial::d_scaleDraw [private]
 

Definition at line 156 of file qwt_dial.h.

Referenced by drawScale(), minimumSizeHint(), QwtDial(), scaleContentsRect(), setScaleDraw(), sizeHint(), updateScale(), and ~QwtDial().

double QwtDial::d_scaleStep [private]
 

Definition at line 159 of file qwt_dial.h.

Referenced by setScale(), and updateScale().

bool QwtDial::d_visibleBackground [private]
 

Definition at line 145 of file qwt_dial.h.

Referenced by hasVisibleBackground(), and showBackground().

bool QwtDial::d_wrapping [private]
 

Definition at line 150 of file qwt_dial.h.

Referenced by setWrapping(), and wrapping().

Q_OBJECT friend class QwtDial::QwtDialScaleDraw [private]
 

Definition at line 45 of file qwt_dial.h.

Referenced by QwtDial().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:47 2003 for Qwt Developer's Guide by doxygen 1.3.2