QWT 7.0.1
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_COUNTER_H
28#define QWT_COUNTER_H
29
30#include "qwt_global.h"
31#include <qwidget.h>
32
65class QWT_EXPORT QwtCounter : public QWidget
66{
67 Q_OBJECT
68
69 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
70 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
71 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
72 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
73
74 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
75 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
76 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
77 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
78
79 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
80 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
81
82 public:
84 enum Button
85 {
88
91
94
96 ButtonCnt
97 };
98
99 explicit QwtCounter( QWidget* parent = NULL );
100 virtual ~QwtCounter();
101
102 void setValid( bool );
103 bool isValid() const;
104
105 void setWrapping( bool );
106 bool wrapping() const;
107
108 bool isReadOnly() const;
109 void setReadOnly( bool );
110
111 void setNumButtons( int );
112 int numButtons() const;
113
114 void setIncSteps( QwtCounter::Button, int numSteps );
115 int incSteps( QwtCounter::Button ) const;
116
117 virtual QSize sizeHint() const QWT_OVERRIDE;
118
119 double singleStep() const;
120 void setSingleStep( double stepSize );
121
122 void setRange( double min, double max );
123
124 double minimum() const;
125 void setMinimum( double );
126
127 double maximum() const;
128 void setMaximum( double );
129
130 void setStepButton1( int nSteps );
131 int stepButton1() const;
132
133 void setStepButton2( int nSteps );
134 int stepButton2() const;
135
136 void setStepButton3( int nSteps );
137 int stepButton3() const;
138
139 double value() const;
140
141 public Q_SLOTS:
142 void setValue( double );
143
144
145 Q_SIGNALS:
150 void buttonReleased ( double value );
151
156 void valueChanged ( double value );
157
158 protected:
159 virtual bool event( QEvent* ) QWT_OVERRIDE;
160 virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
161 virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
162
163 private Q_SLOTS:
164 void btnReleased();
165 void btnClicked();
166 void textChanged();
167
168 private:
169 void incrementValue( int numSteps );
170 void initCounter();
171 void updateButtons();
172 void showNumber( double );
173
174 class PrivateData;
175 PrivateData* m_data;
176};
177
178#endif
The Counter Widget.
Definition qwt_counter.h:66
Button
Button index.
Definition qwt_counter.h:85
@ Button1
Button intended for minor steps.
Definition qwt_counter.h:87
@ Button3
Button intended for large steps.
Definition qwt_counter.h:93
@ Button2
Button intended for medium steps.
Definition qwt_counter.h:90