QWT API (中文) 7.3.0
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
58class QWT_EXPORT QwtCounter : public QWidget
59{
60 Q_OBJECT
61
62 Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
63 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
64 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
65 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
66
67 Q_PROPERTY(int numButtons READ numButtons WRITE setNumButtons)
68 Q_PROPERTY(int stepButton1 READ stepButton1 WRITE setStepButton1)
69 Q_PROPERTY(int stepButton2 READ stepButton2 WRITE setStepButton2)
70 Q_PROPERTY(int stepButton3 READ stepButton3 WRITE setStepButton3)
71
72 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
73 Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
74
75public:
79 enum Button
80 {
83
86
89
91 ButtonCnt
92 };
93
95 explicit QwtCounter(QWidget* parent = nullptr);
97 ~QwtCounter() override;
98
100 void setValid(bool);
102 bool isValid() const;
103
105 void setWrapping(bool);
107 bool wrapping() const;
108
110 bool isReadOnly() const;
112 void setReadOnly(bool);
113
115 void setNumButtons(int);
117 int numButtons() const;
118
120 void setIncSteps(QwtCounter::Button, int numSteps);
122 int incSteps(QwtCounter::Button) const;
123
125 virtual QSize sizeHint() const override;
126
128 double singleStep() const;
130 void setSingleStep(double stepSize);
131
133 void setRange(double min, double max);
134
136 double minimum() const;
138 void setMinimum(double);
139
141 double maximum() const;
143 void setMaximum(double);
144
146 void setStepButton1(int nSteps);
148 int stepButton1() const;
149
151 void setStepButton2(int nSteps);
153 int stepButton2() const;
154
156 void setStepButton3(int nSteps);
158 int stepButton3() const;
159
161 double value() const;
162
163public Q_SLOTS:
164 void setValue(double);
165
166Q_SIGNALS:
171 void buttonReleased(double value);
172
177 void valueChanged(double value);
178
179protected:
180 virtual bool event(QEvent*) override;
181 virtual void wheelEvent(QWheelEvent*) override;
182 virtual void keyPressEvent(QKeyEvent*) override;
183
184private Q_SLOTS:
185 void btnReleased();
186 void btnClicked();
187 void textChanged();
188
189private:
190 void incrementValue(int numSteps);
191 void initCounter();
192 void updateButtons();
193 void showNumber(double);
194
195 QWT_DECLARE_PRIVATE(QwtCounter)
196};
197
198#endif
The Counter Widget
Definition qwt_counter.h:59
Button
Button index
Definition qwt_counter.h:80
@ Button1
Button intended for minor steps
Definition qwt_counter.h:82
@ Button3
Button intended for large steps
Definition qwt_counter.h:88
@ Button2
Button intended for medium steps
Definition qwt_counter.h:85
void buttonReleased(double value)
Signal emitted when a button has been released
void valueChanged(double value)
Signal emitted when the counter's value has changed