QWT 7.0.1
Loading...
Searching...
No Matches
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
49class QWT_EXPORT QwtAbstractSlider : public QwtAbstractScale
50{
51 Q_OBJECT
52
53 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
54
55 Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
56 Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
57 Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
58 Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
59
60 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
61 Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
62 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
63
64 Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
65
66 public:
67 explicit QwtAbstractSlider( QWidget* parent = NULL );
68 virtual ~QwtAbstractSlider();
69
70 void setValid( bool );
71 bool isValid() const;
72
73 double value() const;
74
75 void setWrapping( bool );
76 bool wrapping() const;
77
78 void setTotalSteps( uint );
79 uint totalSteps() const;
80
81 void setSingleSteps( uint );
82 uint singleSteps() const;
83
84 void setPageSteps( uint );
85 uint pageSteps() const;
86
87 void setStepAlignment( bool );
88 bool stepAlignment() const;
89
90 void setTracking( bool );
91 bool isTracking() const;
92
93 void setReadOnly( bool );
94 bool isReadOnly() const;
95
96 void setInvertedControls( bool );
97 bool invertedControls() const;
98
99 public Q_SLOTS:
100 void setValue( double value );
101
102 Q_SIGNALS:
103
114 void valueChanged( double value );
115
121
127
136 void sliderMoved( double value );
137
138 protected:
139 virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
140 virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
141 virtual void mouseMoveEvent( QMouseEvent* ) QWT_OVERRIDE;
142 virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
143 virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
144
153 virtual bool isScrollPosition( const QPoint& pos ) const = 0;
154
164 virtual double scrolledTo( const QPoint& pos ) const = 0;
165
166 void incrementValue( int stepCount );
167
168 virtual void scaleChange() QWT_OVERRIDE;
169
170 protected:
171 virtual void sliderChange();
172
173 double incrementedValue(
174 double value, int stepCount ) const;
175
176 private:
177 double alignedValue( double ) const;
178 double boundedValue( double ) const;
179
180 class PrivateData;
181 PrivateData* m_data;
182};
183
184#endif
An abstract base class for widgets having a scale.
Definition qwt_abstract_scale.h:54
virtual void scaleChange()
Notify changed scale.
Definition qwt_abstract_scale.cpp:420
An abstract base class for slider widgets with a scale.
Definition qwt_abstract_slider.h:50
void valueChanged(double value)
Notify a change of value.
void sliderReleased()
This signal is emitted when the user releases the movable part of the slider.
void sliderMoved(double value)
This signal is emitted when the user moves the slider with the mouse.
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
void sliderPressed()
This signal is emitted when the user presses the movable part of the slider.