Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_counter.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_COUNTER_H
11#define QWT_COUNTER_H
12
13#include "qwt_global.h"
14#include <qwidget.h>
15
48 class QWT_EXPORT QwtCounter : public QWidget
49{
50 Q_OBJECT
51
52 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
53 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
54 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
55 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
56
57 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
58 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
59 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
60 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
61
62 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
63 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
64
65 public:
67 enum Button
68 {
70 Button1,
71
73 Button2,
74
76 Button3,
77
79 ButtonCnt
80 };
81
82 explicit QwtCounter( QWidget* parent = NULL );
83 virtual ~QwtCounter();
84
85 void setValid( bool );
86 bool isValid() const;
87
88 void setWrapping( bool );
89 bool wrapping() const;
90
91 bool isReadOnly() const;
92 void setReadOnly( bool );
93
94 void setNumButtons( int );
95 int numButtons() const;
96
97 void setIncSteps( QwtCounter::Button, int numSteps );
98 int incSteps( QwtCounter::Button ) const;
99
100 virtual QSize sizeHint() const QWT_OVERRIDE;
101
102 double singleStep() const;
103 void setSingleStep( double stepSize );
104
105 void setRange( double min, double max );
106
107 double minimum() const;
108 void setMinimum( double );
109
110 double maximum() const;
111 void setMaximum( double );
112
113 void setStepButton1( int nSteps );
114 int stepButton1() const;
115
116 void setStepButton2( int nSteps );
117 int stepButton2() const;
118
119 void setStepButton3( int nSteps );
120 int stepButton3() const;
121
122 double value() const;
123
124 public Q_SLOTS:
125 void setValue( double );
126
127
128 Q_SIGNALS:
133 void buttonReleased ( double value );
134
139 void valueChanged ( double value );
140
141 protected:
142 virtual bool event( QEvent* ) QWT_OVERRIDE;
143 virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
144 virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
145
146 private Q_SLOTS:
147 void btnReleased();
148 void btnClicked();
149 void textChanged();
150
151 private:
152 void incrementValue( int numSteps );
153 void initCounter();
154 void updateButtons();
155 void showNumber( double );
156
157 class PrivateData;
158 PrivateData* m_data;
159};
160
161#endif
QwtCounter
The Counter Widget.
Definition qwt_counter.h:49
QwtCounter::Button
Button
Button index.
Definition qwt_counter.h:68
QwtCounter::Button1
@ Button1
Button intended for minor steps.
Definition qwt_counter.h:70
QwtCounter::Button3
@ Button3
Button intended for large steps.
Definition qwt_counter.h:76
QwtCounter::Button2
@ Button2
Button intended for medium steps.
Definition qwt_counter.h:73