QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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
80class QWT_EXPORT QwtCounter : public QWidget
81{
82 Q_OBJECT
83
84 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
85 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
86 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
87 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
88
89 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
90 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
91 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
92 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
93
94 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
95 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
96
97 public:
107 {
110
113
116
118 ButtonCnt
119 };
120
122 explicit QwtCounter( QWidget* parent = nullptr );
124 virtual ~QwtCounter();
125
127 void setValid( bool );
129 bool isValid() const;
130
132 void setWrapping( bool );
134 bool wrapping() const;
135
137 bool isReadOnly() const;
139 void setReadOnly( bool );
140
142 void setNumButtons( int );
144 int numButtons() const;
145
147 void setIncSteps( QwtCounter::Button, int numSteps );
149 int incSteps( QwtCounter::Button ) const;
150
152 virtual QSize sizeHint() const override;
153
155 double singleStep() const;
157 void setSingleStep( double stepSize );
158
160 void setRange( double min, double max );
161
163 double minimum() const;
165 void setMinimum( double );
166
168 double maximum() const;
170 void setMaximum( double );
171
173 void setStepButton1( int nSteps );
175 int stepButton1() const;
176
178 void setStepButton2( int nSteps );
180 int stepButton2() const;
181
183 void setStepButton3( int nSteps );
185 int stepButton3() const;
186
188 double value() const;
189
190 public Q_SLOTS:
191 void setValue( double );
192
193
194 Q_SIGNALS:
205 void buttonReleased ( double value );
206
217 void valueChanged ( double value );
218
219 protected:
220 virtual bool event( QEvent* ) override;
221 virtual void wheelEvent( QWheelEvent* ) override;
222 virtual void keyPressEvent( QKeyEvent* ) override;
223
224 private Q_SLOTS:
225 void btnReleased();
226 void btnClicked();
227 void textChanged();
228
229 private:
230 void incrementValue( int numSteps );
231 void initCounter();
232 void updateButtons();
233 void showNumber( double );
234
235 class PrivateData;
236 PrivateData* m_data;
237};
238
239#endif
计数器控件
Definition qwt_counter.h:81
Button
按钮索引
Definition qwt_counter.h:107
@ Button1
Button intended for minor steps
Definition qwt_counter.h:109
@ Button3
Button intended for large steps
Definition qwt_counter.h:115
@ Button2
Button intended for medium steps
Definition qwt_counter.h:112
void buttonReleased(double value)
当按钮释放时发出的信号
void valueChanged(double value)
当计数器值改变时发出的信号