qwt_dial.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_H
#define QWT_DIAL_H
#include "qwt_global.h"
#include "qwt_abstract_slider.h"
#include <qframe.h>
#include <qpalette.h>
class QwtDialNeedle;
class QwtRoundScaleDraw;
class QwtAbstractScaleDraw;
class QWT_EXPORT QwtDial : public QwtAbstractSlider
{
Q_OBJECT
Q_ENUMS( Shadow Mode Direction )
Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
Q_PROPERTY( Mode mode READ mode WRITE setMode )
Q_PROPERTY( double origin READ origin WRITE setOrigin )
Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc )
Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
public:
enum Shadow
{
Plain = QFrame::Plain,
Raised = QFrame::Raised,
Sunken = QFrame::Sunken
};
enum Mode
{
RotateNeedle,
RotateScale
};
explicit QwtDial( QWidget* parent = NULL );
virtual ~QwtDial();
void setFrameShadow( Shadow );
Shadow frameShadow() const;
void setLineWidth( int );
int lineWidth() const;
void setMode( Mode );
Mode mode() const;
void setScaleArc( double minArc, double maxArc );
void setMinScaleArc( double );
double minScaleArc() const;
void setMaxScaleArc( double );
double maxScaleArc() const;
virtual void setOrigin( double );
double origin() const;
void setNeedle( QwtDialNeedle* );
const QwtDialNeedle* needle() const;
QwtDialNeedle* needle();
QRect boundingRect() const;
QRect innerRect() const;
virtual QRect scaleInnerRect() const;
virtual QSize sizeHint() const QWT_OVERRIDE;
virtual QSize minimumSizeHint() const QWT_OVERRIDE;
void setScaleDraw( QwtRoundScaleDraw* );
QwtRoundScaleDraw* scaleDraw();
const QwtRoundScaleDraw* scaleDraw() const;
protected:
virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
virtual void drawFrame( QPainter* );
virtual void drawContents( QPainter* ) const;
virtual void drawFocusIndicator( QPainter* ) const;
void invalidateCache();
virtual void drawScale( QPainter*,
const QPointF& center, double radius ) const;
virtual void drawScaleContents( QPainter* painter,
const QPointF& center, double radius ) const;
virtual void drawNeedle( QPainter*, const QPointF&,
double radius, double direction, QPalette::ColorGroup ) const;
virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
virtual void sliderChange() QWT_OVERRIDE;
virtual void scaleChange() QWT_OVERRIDE;
private:
void setAngleRange( double angle, double span );
void drawNeedle( QPainter* ) const;
class PrivateData;
PrivateData* m_data;
};
#endif
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition: qwt_abstract_scale_draw.h:32
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:33
QwtDial
QwtDial class provides a rounded range control.
Definition: qwt_dial.h:51
QwtDial::Mode
Mode
Mode controlling whether the needle or the scale is rotating.
Definition: qwt_dial.h:87
QwtDial::RotateNeedle
@ RotateNeedle
The needle is rotating.
Definition: qwt_dial.h:89
QwtDial::Shadow
Shadow
Frame shadow.
Definition: qwt_dial.h:74
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:32