Qwt User's Guide: QwtDialSimpleNeedle Class Reference

# QwtDialSimpleNeedle Class Reference

A needle for dial widgets. More...

`#include <qwt_dial_needle.h>`

Inheritance diagram for QwtDialSimpleNeedle:
[legend]

List of all members.

## Public Types
enum | Style { Arrow, Ray }
## Public Member Functions
| QwtDialSimpleNeedle (Style, bool hasKnob=true, const QColor &mid=Qt::gray, const QColor &base=Qt::darkGray)
virtual void | draw (QPainter *, const QPoint &, int length, double direction, QPalette::ColorGroup=QPalette::Active) const
void | setWidth (int width)
int | width () const
## Static Public Member Functions
static void | drawArrowNeedle (QPainter *, const QPalette &, QPalette::ColorGroup, const QPoint &, int length, int width, double direction, bool hasKnob)
static void | drawRayNeedle (QPainter *, const QPalette &, QPalette::ColorGroup, const QPoint &, int length, int width, double direction, bool hasKnob)

## Detailed Description

A needle for dial widgets.

The following colors are used:

- QColorGroup::Mid
  Pointer
- QColorGroup::base
  Knob

See also:
  QwtDial, QwtCompass

## Member Enumeration Documentation

enum QwtDialSimpleNeedle::Style

Style of the needle.

## Constructor & Destructor Documentation

QwtDialSimpleNeedle::QwtDialSimpleNeedle | ( | Style | style,
|  | bool | hasKnob = `true`,
|  | const QColor & | mid = `Qt::gray`,
|  | const QColor & | base = `Qt::darkGray` |
| ) |  |  |

Constructor

Parameters:

  | style | Style
  | hasKnob | With/Without knob
  | mid | Middle color
  | base | Base color

## Member Function Documentation

void QwtDialSimpleNeedle::draw | ( | QPainter * | painter,
|  | const QPoint & | center,
|  | int | length,
|  | double | direction,
|  | QPalette::ColorGroup | colorGroup = `QPalette::Active` |
| ) |  |  | const`[virtual]`

Draw the needle

Parameters:

  | painter | Painter
  | center | Center of the dial, start position for the needle
  | length | Length of the needle
  | direction | Direction of the needle, in degrees counter clockwise
  | colorGroup | Color group, used for painting

Implements QwtDialNeedle.

void QwtDialSimpleNeedle::drawArrowNeedle | ( | QPainter * | painter,
|  | const QPalette & | palette,
|  | QPalette::ColorGroup | colorGroup,
|  | const QPoint & | center,
|  | int | length,
|  | int | width,
|  | double | direction,
|  | bool | hasKnob |
| ) |  |  | `[static]`

Draw a needle looking like an arrow

Parameters:

  | painter | Painter
  | palette | Palette
  | colorGroup | Color group
  | center | center of the needle
  | length | Length of the needle
  | width | Width of the needle
  | direction | Current Direction
  | hasKnob | With/Without knob

void QwtDialSimpleNeedle::drawRayNeedle | ( | QPainter * | painter,
|  | const QPalette & | palette,
|  | QPalette::ColorGroup | colorGroup,
|  | const QPoint & | center,
|  | int | length,
|  | int | width,
|  | double | direction,
|  | bool | hasKnob |
| ) |  |  | `[static]`

Draw a needle looking like a ray

Parameters:

  | painter | Painter
  | palette | Palette
  | colorGroup | Color group
  | center | center of the needle
  | length | Length of the needle
  | width | Width of the needle
  | direction | Current Direction
  | hasKnob | With/Without knob

void QwtDialSimpleNeedle::setWidth | ( | int | width | ) |

Set the width of the needle

Parameters:

  | width | Width

See also:
  width()

int QwtDialSimpleNeedle::width | ( |  | ) | const

Returns:
  the width of the needle

See also:
  setWidth()