Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_COUNTER_H
00011 #define QWT_COUNTER_H
00012
00013 #include "qwt_global.h"
00014 #include <qwidget.h>
00015
00048 class QWT_EXPORT QwtCounter : public QWidget
00049 {
00050 Q_OBJECT
00051
00052 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
00053 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
00054 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
00055 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
00056
00057 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
00058 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
00059 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
00060 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
00061
00062 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
00063 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
00064
00065 public:
00067 enum Button
00068 {
00070 Button1,
00071
00073 Button2,
00074
00076 Button3,
00077
00079 ButtonCnt
00080 };
00081
00082 explicit QwtCounter( QWidget *parent = NULL );
00083 virtual ~QwtCounter();
00084
00085 void setValid( bool );
00086 bool isValid() const;
00087
00088 void setWrapping( bool );
00089 bool wrapping() const;
00090
00091 bool isReadOnly() const;
00092 void setReadOnly( bool );
00093
00094 void setNumButtons( int n );
00095 int numButtons() const;
00096
00097 void setIncSteps( QwtCounter::Button btn, int nSteps );
00098 int incSteps( QwtCounter::Button btn ) const;
00099
00100 virtual QSize sizeHint() const;
00101
00102 double singleStep() const;
00103 void setSingleStep( double s );
00104
00105 void setRange( double min, double max );
00106
00107 double minimum() const;
00108 void setMinimum( double min );
00109
00110 double maximum() const;
00111 void setMaximum( double max );
00112
00113 void setStepButton1( int nSteps );
00114 int stepButton1() const;
00115
00116 void setStepButton2( int nSteps );
00117 int stepButton2() const;
00118
00119 void setStepButton3( int nSteps );
00120 int stepButton3() const;
00121
00122 double value() const;
00123
00124 public Q_SLOTS:
00125 void setValue( double );
00126
00127
00128 Q_SIGNALS:
00133 void buttonReleased ( double value );
00134
00139 void valueChanged ( double value );
00140
00141 protected:
00142 virtual bool event( QEvent * );
00143 virtual void wheelEvent( QWheelEvent * );
00144 virtual void keyPressEvent( QKeyEvent * );
00145
00146 private Q_SLOTS:
00147 void btnReleased();
00148 void btnClicked();
00149 void textChanged();
00150
00151 private:
00152 void incrementValue( int numSteps );
00153 void initCounter();
00154 void updateButtons();
00155 void showNumber( double );
00156
00157 class PrivateData;
00158 PrivateData *d_data;
00159 };
00160
00161 #endif