Qwt User's Guide 6.1.0

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_abstract_slider.h
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
32 class 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
49 public:
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
82 public Q_SLOTS:
83 void setValue( double val );
84
85 Q_SIGNALS:
86
97 void valueChanged( double value );
98
103 void sliderPressed();
104
109 void sliderReleased();
110
119 void sliderMoved( double value );
120
121 protected:
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
136 virtual bool isScrollPosition( const QPoint &pos ) const = 0;
137
147 virtual double scrolledTo( const QPoint &pos ) const = 0;
148
149 void incrementValue( int numSteps );
150
151 virtual void scaleChange();
152
153 protected:
154 virtual void sliderChange();
155
156 double incrementedValue(
157 double value, int stepCount ) const;
158
159 private:
160 double alignedValue( double ) const;
161 double boundedValue( double ) const;
162
163 class PrivateData;
164 PrivateData *d_data;
165 };
166
167 #endif