QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_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_SLIDER_H
28#define QWT_SLIDER_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_slider.h"
32
33class QwtScaleDraw;
34
53class QWT_EXPORT QwtSlider : public QwtAbstractSlider
54{
55 Q_OBJECT
56
57 Q_ENUMS( ScalePosition BackgroundStyle )
58
59 Q_PROPERTY( Qt::Orientation orientation
60 READ orientation WRITE setOrientation )
61 Q_PROPERTY( ScalePosition scalePosition READ scalePosition
62 WRITE setScalePosition )
63
64 Q_PROPERTY( bool trough READ hasTrough WRITE setTrough )
65 Q_PROPERTY( bool groove READ hasGroove WRITE setGroove )
66
67 Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize )
68 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
69 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
70
71 public:
72
84 {
87
90
92 TrailingScale
93 };
94
96 explicit QwtSlider( QWidget* parent = nullptr );
98 explicit QwtSlider( Qt::Orientation, QWidget* parent = nullptr );
99
101 virtual ~QwtSlider();
102
104 void setOrientation( Qt::Orientation );
106 Qt::Orientation orientation() const;
107
109 void setScalePosition( ScalePosition );
111 ScalePosition scalePosition() const;
112
114 void setTrough( bool );
116 bool hasTrough() const;
117
119 void setGroove( bool );
121 bool hasGroove() const;
122
124 void setHandleSize( const QSize& );
126 QSize handleSize() const;
127
129 void setBorderWidth( int );
131 int borderWidth() const;
132
134 void setSpacing( int );
136 int spacing() const;
137
139 virtual QSize sizeHint() const override;
141 virtual QSize minimumSizeHint() const override;
142
144 void setScaleDraw( QwtScaleDraw* );
146 const QwtScaleDraw* scaleDraw() const;
147
149 void setUpdateInterval( int );
151 int updateInterval() const;
152
153 protected:
155 virtual double scrolledTo( const QPoint& ) const override;
157 virtual bool isScrollPosition( const QPoint& ) const override;
158
160 virtual void drawSlider ( QPainter*, const QRect& ) const;
162 virtual void drawHandle( QPainter*, const QRect&, int pos ) const;
163
165 virtual void mousePressEvent( QMouseEvent* ) override;
167 virtual void mouseReleaseEvent( QMouseEvent* ) override;
169 virtual void resizeEvent( QResizeEvent* ) override;
171 virtual void paintEvent ( QPaintEvent* ) override;
173 virtual void changeEvent( QEvent* ) override;
175 virtual void timerEvent( QTimerEvent* ) override;
176
178 virtual bool event( QEvent* ) override;
179
181 virtual void scaleChange() override;
182
184 QRect sliderRect() const;
186 QRect handleRect() const;
187
188 private:
190 QwtScaleDraw* scaleDraw();
191
193 void layoutSlider( bool );
195 void initSlider( Qt::Orientation );
196
197 class PrivateData;
198 PrivateData* m_data;
199};
200
201#endif
virtual void changeEvent(QEvent *) override
Handle change events (English only)
Definition qwt_abstract_scale.cpp:670
带刻度的滑块控件的抽象基类
Definition qwt_abstract_slider.h:57
virtual void scaleChange() override
Handle scale changes (English only)
Definition qwt_abstract_slider.cpp:1007
virtual void mouseReleaseEvent(QMouseEvent *) override
Handle mouse release events (English only)
Definition qwt_abstract_slider.cpp:351
virtual void mousePressEvent(QMouseEvent *) override
Handle mouse press events (English only)
Definition qwt_abstract_slider.cpp:270
virtual bool isScrollPosition(const QPoint &pos) const =0
确定当用户按下鼠标按钮时该做什么
virtual double scrolledTo(const QPoint &pos) const =0
确定滑块可移动部分新位置的值
用于绘制刻度的类
Definition qwt_scale_draw.h:62
滑块控件
Definition qwt_slider.h:54
ScalePosition
刻度位置
Definition qwt_slider.h:84
@ LeadingScale
The scale is right of a vertical or below a horizontal slider
Definition qwt_slider.h:89
@ NoScale
The slider has no scale
Definition qwt_slider.h:86