qwt_dial_needle.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DIAL_NEEDLE_H
#define QWT_DIAL_NEEDLE_H
#include "qwt_global.h"
#include <qpalette.h>
class QPainter;
class QWT_EXPORT QwtDialNeedle
{
public:
QwtDialNeedle();
virtual ~QwtDialNeedle();
virtual void setPalette( const QPalette& );
const QPalette& palette() const;
virtual void draw( QPainter*, const QPointF& center,
double length, double direction,
QPalette::ColorGroup = QPalette::Active ) const;
protected:
virtual void drawNeedle( QPainter* painter,
double length, QPalette::ColorGroup colorGroup ) const = 0;
virtual void drawKnob( QPainter*, double width,
const QBrush&, bool sunken ) const;
private:
Q_DISABLE_COPY(QwtDialNeedle)
QPalette m_palette;
};
class QWT_EXPORT QwtDialSimpleNeedle : public QwtDialNeedle
{
public:
enum Style
{
Arrow,
Ray
};
QwtDialSimpleNeedle( Style, bool hasKnob = true,
const QColor& mid = Qt::gray, const QColor& base = Qt::darkGray );
void setWidth( double width );
double width() const;
protected:
virtual void drawNeedle( QPainter*, double length,
QPalette::ColorGroup ) const QWT_OVERRIDE;
private:
Style m_style;
bool m_hasKnob;
double m_width;
};
class QWT_EXPORT QwtCompassMagnetNeedle : public QwtDialNeedle
{
public:
enum Style
{
TriangleStyle,
ThinStyle
};
QwtCompassMagnetNeedle( Style = TriangleStyle,
const QColor& light = Qt::white, const QColor& dark = Qt::red );
protected:
virtual void drawNeedle( QPainter*,
double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
private:
Style m_style;
};
class QWT_EXPORT QwtCompassWindArrow : public QwtDialNeedle
{
public:
enum Style
{
Style1,
Style2
};
QwtCompassWindArrow( Style, const QColor& light = Qt::white,
const QColor& dark = Qt::gray );
protected:
virtual void drawNeedle( QPainter*,
double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
private:
Style m_style;
};
#endif
QwtCompassMagnetNeedle
A magnet needle for compass widgets.
Definition: qwt_dial_needle.h:128
QwtCompassMagnetNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:132
QwtCompassMagnetNeedle::TriangleStyle
@ TriangleStyle
A needle with a triangular shape.
Definition: qwt_dial_needle.h:134
QwtCompassWindArrow
An indicator for the wind direction.
Definition: qwt_dial_needle.h:165
QwtCompassWindArrow::Style
Style
Style of the arrow.
Definition: qwt_dial_needle.h:169
QwtCompassWindArrow::Style1
@ Style1
A needle pointing to the center.
Definition: qwt_dial_needle.h:171
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtDialNeedle::drawNeedle
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.
QwtDialSimpleNeedle
A needle for dial widgets.
Definition: qwt_dial_needle.h:82
QwtDialSimpleNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:86
QwtDialSimpleNeedle::Arrow
@ Arrow
Arrow.
Definition: qwt_dial_needle.h:88