QWT 7.0.1
Loading...
Searching...
No Matches
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
47class QWT_EXPORT QwtSlider : public QwtAbstractSlider
48{
49 Q_OBJECT
50
51 Q_ENUMS( ScalePosition BackgroundStyle )
52
53 Q_PROPERTY( Qt::Orientation orientation
54 READ orientation WRITE setOrientation )
55 Q_PROPERTY( ScalePosition scalePosition READ scalePosition
56 WRITE setScalePosition )
57
58 Q_PROPERTY( bool trough READ hasTrough WRITE setTrough )
59 Q_PROPERTY( bool groove READ hasGroove WRITE setGroove )
60
61 Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize )
62 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
63 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
64
65 public:
66
72 {
75
78
80 TrailingScale
81 };
82
83 explicit QwtSlider( QWidget* parent = NULL );
84 explicit QwtSlider( Qt::Orientation, QWidget* parent = NULL );
85
86 virtual ~QwtSlider();
87
88 void setOrientation( Qt::Orientation );
89 Qt::Orientation orientation() const;
90
91 void setScalePosition( ScalePosition );
92 ScalePosition scalePosition() const;
93
94 void setTrough( bool );
95 bool hasTrough() const;
96
97 void setGroove( bool );
98 bool hasGroove() const;
99
100 void setHandleSize( const QSize& );
101 QSize handleSize() const;
102
103 void setBorderWidth( int );
104 int borderWidth() const;
105
106 void setSpacing( int );
107 int spacing() const;
108
109 virtual QSize sizeHint() const QWT_OVERRIDE;
110 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
111
112 void setScaleDraw( QwtScaleDraw* );
113 const QwtScaleDraw* scaleDraw() const;
114
115 void setUpdateInterval( int );
116 int updateInterval() const;
117
118 protected:
119 virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
120 virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
121
122 virtual void drawSlider ( QPainter*, const QRect& ) const;
123 virtual void drawHandle( QPainter*, const QRect&, int pos ) const;
124
125 virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
126 virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
127 virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
128 virtual void paintEvent ( QPaintEvent* ) QWT_OVERRIDE;
129 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
130 virtual void timerEvent( QTimerEvent* ) QWT_OVERRIDE;
131
132 virtual bool event( QEvent* ) QWT_OVERRIDE;
133
134 virtual void scaleChange() QWT_OVERRIDE;
135
136 QRect sliderRect() const;
137 QRect handleRect() const;
138
139 private:
140 QwtScaleDraw* scaleDraw();
141
142 void layoutSlider( bool );
143 void initSlider( Qt::Orientation );
144
145 class PrivateData;
146 PrivateData* m_data;
147};
148
149#endif
An abstract base class for slider widgets with a scale.
Definition qwt_abstract_slider.h:50
A class for drawing scales.
Definition qwt_scale_draw.h:53
The Slider Widget.
Definition qwt_slider.h:48
ScalePosition
Position of the scale.
Definition qwt_slider.h:72
@ LeadingScale
The scale is right of a vertical or below a horizontal slider.
Definition qwt_slider.h:77
@ NoScale
The slider has no scale.
Definition qwt_slider.h:74