QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_abstract_slider.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_ABSTRACT_SLIDER_H
28#define QWT_ABSTRACT_SLIDER_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_scale.h"
32
46class QWT_EXPORT QwtAbstractSlider : public QwtAbstractScale
47{
48 Q_OBJECT
49
50 Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
51
52 Q_PROPERTY(uint totalSteps READ totalSteps WRITE setTotalSteps)
53 Q_PROPERTY(uint singleSteps READ singleSteps WRITE setSingleSteps)
54 Q_PROPERTY(uint pageSteps READ pageSteps WRITE setPageSteps)
55 Q_PROPERTY(bool stepAlignment READ stepAlignment WRITE setStepAlignment)
56
57 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
58 Q_PROPERTY(bool tracking READ isTracking WRITE setTracking)
59 Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
60
61 Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
62
63public:
65 explicit QwtAbstractSlider(QWidget* parent = nullptr);
66
69
71 void setValid(bool);
72
74 bool isValid() const;
75
77 double value() const;
78
80 void setWrapping(bool);
81
83 bool wrapping() const;
84
86 void setTotalSteps(uint);
87
89 uint totalSteps() const;
90
92 void setSingleSteps(uint);
93
95 uint singleSteps() const;
96
98 void setPageSteps(uint);
99
101 uint pageSteps() const;
102
104 void setStepAlignment(bool);
105
107 bool stepAlignment() const;
108
110 void setTracking(bool);
111
113 bool isTracking() const;
114
116 void setReadOnly(bool);
117
119 bool isReadOnly() const;
120
122 void setInvertedControls(bool);
123
125 bool invertedControls() const;
126
127public Q_SLOTS:
129 void setValue(double value);
130
131Q_SIGNALS:
132
140 void valueChanged(double value);
141
146
151
157 void sliderMoved(double value);
158
159protected:
161 virtual void mousePressEvent(QMouseEvent*) override;
162
164 virtual void mouseReleaseEvent(QMouseEvent*) override;
165
167 virtual void mouseMoveEvent(QMouseEvent*) override;
168
170 virtual void keyPressEvent(QKeyEvent*) override;
171
173 virtual void wheelEvent(QWheelEvent*) override;
174
175 // Determine what to do when the user presses a mouse button
176 virtual bool isScrollPosition(const QPoint& pos) const = 0;
177
178 // Determine the value for a new position of the movable part of the slider
179 virtual double scrolledTo(const QPoint& pos) const = 0;
180
182 void incrementValue(int stepCount);
183
185 virtual void scaleChange() override;
186
187protected:
189 virtual void sliderChange();
190
192 double incrementedValue(double value, int stepCount) const;
193
194private:
195 double alignedValue(double) const;
196 double boundedValue(double) const;
197
198 QWT_DECLARE_PRIVATE(QwtAbstractSlider)
199};
200
201#endif
An abstract base class for widgets having a scale
Definition qwt_abstract_scale.h:51
virtual void scaleChange()
Notify about scale changes (English only)
Definition qwt_abstract_scale.cpp:423
An abstract base class for slider widgets with a scale
Definition qwt_abstract_slider.h:47
void valueChanged(double value)
Notify a change of value
~QwtAbstractSlider() override
Destructor for QwtAbstractSlider (English only)
void sliderReleased()
Signal emitted when the user releases the movable part of the slider
void sliderMoved(double value)
Signal emitted when the user moves the slider with the mouse
void sliderPressed()
Signal emitted when the user presses the movable part of the slider