Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_KNOB_H
00011 #define QWT_KNOB_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_abstract_slider.h"
00015
00016 class QwtRoundScaleDraw;
00017
00042 class QWT_EXPORT QwtKnob: public QwtAbstractSlider
00043 {
00044 Q_OBJECT
00045
00046 Q_ENUMS ( KnobStyle MarkerStyle )
00047
00048 Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle )
00049 Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
00050 Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment )
00051 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
00052 Q_PROPERTY( int numTurns READ numTurns WRITE setNumTurns )
00053 Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerStyle )
00054 Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize )
00055 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
00056
00057 public:
00066 enum KnobStyle
00067 {
00069 Flat,
00070
00072 Raised,
00073
00078 Sunken,
00079
00084 Styled
00085 };
00086
00095 enum MarkerStyle
00096 {
00098 NoMarker = -1,
00099
00101 Tick,
00102
00104 Triangle,
00105
00107 Dot,
00108
00113 Nub,
00114
00119 Notch
00120 };
00121
00122 explicit QwtKnob( QWidget* parent = NULL );
00123 virtual ~QwtKnob();
00124
00125 void setAlignment( Qt::Alignment );
00126 Qt::Alignment alignment() const;
00127
00128 void setKnobWidth( int );
00129 int knobWidth() const;
00130
00131 void setNumTurns( int );
00132 int numTurns() const;
00133
00134 void setTotalAngle ( double angle );
00135 double totalAngle() const;
00136
00137 void setKnobStyle( KnobStyle );
00138 KnobStyle knobStyle() const;
00139
00140 void setBorderWidth( int bw );
00141 int borderWidth() const;
00142
00143 void setMarkerStyle( MarkerStyle );
00144 MarkerStyle markerStyle() const;
00145
00146 void setMarkerSize( int );
00147 int markerSize() const;
00148
00149 virtual QSize sizeHint() const;
00150 virtual QSize minimumSizeHint() const;
00151
00152 void setScaleDraw( QwtRoundScaleDraw * );
00153
00154 const QwtRoundScaleDraw *scaleDraw() const;
00155 QwtRoundScaleDraw *scaleDraw();
00156
00157 QRect knobRect() const;
00158
00159 protected:
00160 virtual void paintEvent( QPaintEvent * );
00161 virtual void changeEvent( QEvent * );
00162
00163 virtual void drawKnob( QPainter *, const QRectF & ) const;
00164
00165 virtual void drawFocusIndicator( QPainter * ) const;
00166
00167 virtual void drawMarker( QPainter *,
00168 const QRectF &, double arc ) const;
00169
00170 virtual double scrolledTo( const QPoint & ) const;
00171 virtual bool isScrollPosition( const QPoint & ) const;
00172
00173 private:
00174 class PrivateData;
00175 PrivateData *d_data;
00176 };
00177
00178 #endif