source: ntrip/trunk/BNC/qwt/qwt_abstract_slider.h@ 10527

Last change on this file since 10527 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 4.3 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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
10#ifndef QWT_ABSTRACT_SLIDER_H
11#define QWT_ABSTRACT_SLIDER_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_scale.h"
15
16/*!
17 \brief An abstract base class for slider widgets with a scale
18
19 A slider widget displays a value according to a scale.
20 The class is designed as a common super class for widgets like
21 QwtKnob, QwtDial and QwtSlider.
22
23 When the slider is nor readOnly() its value can be modified
24 by keyboard, mouse and wheel inputs.
25
26 The range of the slider is divided into a number of steps from
27 which the value increments according to user inputs depend.
28 Only for linear scales the number of steps correspond with
29 a fixed step size.
30*/
31
32class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale
33{
34 Q_OBJECT
35
36 Q_PROPERTY( double value READ value WRITE setValue )
37
38 Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
39 Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
40 Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
41 Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
42
43 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
44 Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
45 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
46
47 Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
48
49public:
50 explicit QwtAbstractSlider( QWidget *parent = NULL );
51 virtual ~QwtAbstractSlider();
52
53 void setValid( bool );
54 bool isValid() const;
55
56 double value() const;
57
58 void setWrapping( bool );
59 bool wrapping() const;
60
61 void setTotalSteps( uint );
62 uint totalSteps() const;
63
64 void setSingleSteps( uint );
65 uint singleSteps() const;
66
67 void setPageSteps( uint );
68 uint pageSteps() const;
69
70 void setStepAlignment( bool );
71 bool stepAlignment() const;
72
73 void setTracking( bool );
74 bool isTracking() const;
75
76 void setReadOnly( bool );
77 bool isReadOnly() const;
78
79 void setInvertedControls( bool );
80 bool invertedControls() const;
81
82public Q_SLOTS:
83 void setValue( double value );
84
85Q_SIGNALS:
86
87 /*!
88 \brief Notify a change of value.
89
90 When tracking is enabled (default setting),
91 this signal will be emitted every time the value changes.
92
93 \param value New value
94
95 \sa setTracking(), sliderMoved()
96 */
97 void valueChanged( double value );
98
99 /*!
100 This signal is emitted when the user presses the
101 movable part of the slider.
102 */
103 void sliderPressed();
104
105 /*!
106 This signal is emitted when the user releases the
107 movable part of the slider.
108 */
109 void sliderReleased();
110
111 /*!
112 This signal is emitted when the user moves the
113 slider with the mouse.
114
115 \param value New value
116
117 \sa valueChanged()
118 */
119 void sliderMoved( double value );
120
121protected:
122 virtual void mousePressEvent( QMouseEvent * );
123 virtual void mouseReleaseEvent( QMouseEvent * );
124 virtual void mouseMoveEvent( QMouseEvent * );
125 virtual void keyPressEvent( QKeyEvent * );
126 virtual void wheelEvent( QWheelEvent * );
127
128 /*!
129 \brief Determine what to do when the user presses a mouse button.
130
131 \param pos Mouse position
132
133 \retval True, when pos is a valid scroll position
134 \sa scrolledTo()
135 */
136 virtual bool isScrollPosition( const QPoint &pos ) const = 0;
137
138 /*!
139 \brief Determine the value for a new position of the
140 movable part of the slider
141
142 \param pos Mouse position
143
144 \return Value for the mouse position
145 \sa isScrollPosition()
146 */
147 virtual double scrolledTo( const QPoint &pos ) const = 0;
148
149 void incrementValue( int stepCount );
150
151 virtual void scaleChange();
152
153protected:
154 virtual void sliderChange();
155
156 double incrementedValue(
157 double value, int stepCount ) const;
158
159private:
160 double alignedValue( double ) const;
161 double boundedValue( double ) const;
162
163 class PrivateData;
164 PrivateData *d_data;
165};
166
167#endif
Note: See TracBrowser for help on using the repository browser.