qwt_dial.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* 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 1
#include "qwt_global.h"
#include "qwt_abstract_slider.h"
#include "qwt_abstract_scale_draw.h"
#include <qframe.h>
#include <qpalette.h>
class QwtDialNeedle;
class QwtRoundScaleDraw;
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;
virtual QSize minimumSizeHint() const;
void setScaleDraw( QwtRoundScaleDraw * );
QwtRoundScaleDraw *scaleDraw();
const QwtRoundScaleDraw *scaleDraw() const;
protected:
virtual void wheelEvent( QWheelEvent * );
virtual void paintEvent( QPaintEvent * );
virtual void changeEvent( QEvent * );
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;
virtual bool isScrollPosition( const QPoint & ) const;
virtual void sliderChange();
virtual void scaleChange();
private:
void setAngleRange( double angle, double span );
void drawNeedle( QPainter * ) const;
class PrivateData;
PrivateData *d_data;
};
#endif
QwtDial::Shadow
Shadow
Frame shadow.
Definition: qwt_dial.h:72
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:30
QwtDial
QwtDial class provides a rounded range control.
Definition: qwt_dial.h:49
QwtAbstractSlider::wheelEvent
virtual void wheelEvent(QWheelEvent *)
Definition: qwt_abstract_slider.cpp:299
QwtAbstractSlider::sliderChange
virtual void sliderChange()
Calling update()
Definition: qwt_abstract_slider.cpp:819
QwtDial::Mode
Mode
Mode controlling whether the needle or the scale is rotating.
Definition: qwt_dial.h:85
QwtDial::RotateNeedle
The needle is rotating.
Definition: qwt_dial.h:88
QwtAbstractSlider::scaleChange
virtual void scaleChange()
Definition: qwt_abstract_slider.cpp:801
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:32
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtAbstractSlider::isScrollPosition
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.