qwt_dial.h
Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_DIAL_H
00011 #define QWT_DIAL_H 1
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_abstract_slider.h"
00015 #include "qwt_abstract_scale_draw.h"
00016 #include <qframe.h>
00017 #include <qpalette.h>
00018 
00019 class QwtDialNeedle;
00020 class QwtRoundScaleDraw;
00021 
00049 class QWT_EXPORT QwtDial: public QwtAbstractSlider
00050 {
00051     Q_OBJECT
00052 
00053     Q_ENUMS( Shadow Mode Direction )
00054 
00055     Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
00056     Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
00057     Q_PROPERTY( Mode mode READ mode WRITE setMode )
00058     Q_PROPERTY( double origin READ origin WRITE setOrigin )
00059     Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc )
00060     Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
00061 
00062 public:
00063 
00072     enum Shadow
00073     {
00075         Plain = QFrame::Plain,
00076 
00078         Raised = QFrame::Raised,
00079 
00081         Sunken = QFrame::Sunken
00082     };
00083 
00085     enum Mode
00086     {
00088         RotateNeedle,
00089 
00091         RotateScale
00092     };
00093 
00094     explicit QwtDial( QWidget *parent = NULL );
00095     virtual ~QwtDial();
00096 
00097     void setFrameShadow( Shadow );
00098     Shadow frameShadow() const;
00099 
00100     void setLineWidth( int );
00101     int lineWidth() const;
00102 
00103     void setMode( Mode );
00104     Mode mode() const;
00105 
00106     void setScaleArc( double min, double max );
00107 
00108     void setMinScaleArc( double min );
00109     double minScaleArc() const;
00110 
00111     void setMaxScaleArc( double min );
00112     double maxScaleArc() const;
00113 
00114     virtual void setOrigin( double );
00115     double origin() const;
00116 
00117     void setNeedle( QwtDialNeedle * );
00118     const QwtDialNeedle *needle() const;
00119     QwtDialNeedle *needle();
00120 
00121     QRect boundingRect() const;
00122     QRect innerRect() const;
00123 
00124     virtual QRect scaleInnerRect() const;
00125 
00126     virtual QSize sizeHint() const;
00127     virtual QSize minimumSizeHint() const;
00128 
00129     void setScaleDraw( QwtRoundScaleDraw * );
00130 
00131     QwtRoundScaleDraw *scaleDraw();
00132     const QwtRoundScaleDraw *scaleDraw() const;
00133 
00134 protected:
00135     virtual void wheelEvent( QWheelEvent * );
00136     virtual void paintEvent( QPaintEvent * );
00137     virtual void changeEvent( QEvent * );
00138 
00139     virtual void drawFrame( QPainter *p );
00140     virtual void drawContents( QPainter * ) const;
00141     virtual void drawFocusIndicator( QPainter * ) const;
00142 
00143     void invalidateCache();
00144 
00145     virtual void drawScale( QPainter *, 
00146         const QPointF &center, double radius ) const;
00147 
00148     virtual void drawScaleContents( QPainter *painter, 
00149         const QPointF &center, double radius ) const;
00150 
00151     virtual void drawNeedle( QPainter *, const QPointF &,
00152         double radius, double direction, QPalette::ColorGroup ) const;
00153 
00154     virtual double scrolledTo( const QPoint & ) const;
00155     virtual bool isScrollPosition( const QPoint & ) const;
00156 
00157     virtual void sliderChange();
00158     virtual void scaleChange();
00159 
00160 private:
00161     void setAngleRange( double angle, double span );
00162     void drawNeedle( QPainter * ) const;
00163 
00164     class PrivateData;
00165     PrivateData *d_data;
00166 };
00167 
00168 #endif


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:56