Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

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_double_range.h"
15 #include <qwidget.h>
16
28 class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange
29 {
30 Q_OBJECT
31 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
32 Q_PROPERTY( bool valid READ isValid WRITE setValid )
33 Q_PROPERTY( double mass READ mass WRITE setMass )
34 Q_PROPERTY( Qt::Orientation orientation
35 READ orientation WRITE setOrientation )
36
37 public:
42 enum ScrollMode
43 {
45 ScrNone,
46
51 ScrMouse,
52
57 ScrTimer,
58
59 ScrDirect,
60
62 ScrPage
63 };
64
65 explicit QwtAbstractSlider( Qt::Orientation, QWidget *parent = NULL );
66 virtual ~QwtAbstractSlider();
67
68 void setUpdateTime( int t );
69 void stopMoving();
70 void setTracking( bool enable );
71
72 virtual void setMass( double val );
73 virtual double mass() const;
74
75 virtual void setOrientation( Qt::Orientation o );
76 Qt::Orientation orientation() const;
77
78 bool isReadOnly() const;
79
80 /*
81 Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made
82 to be available as Q_PROPERTY in the designer.
83 */
84
88 bool isValid() const
89 {
90 return QwtDoubleRange::isValid();
91 }
92
97 void setValid( bool valid )
98 {
99 QwtDoubleRange::setValid( valid );
100 }
101
102 public Q_SLOTS:
103 virtual void setValue( double val );
104 virtual void fitValue( double val );
105 virtual void incValue( int steps );
106
107 virtual void setReadOnly( bool );
108
109 Q_SIGNALS:
110
119 void valueChanged( double value );
120
125 void sliderPressed();
126
132 void sliderReleased();
138 void sliderMoved( double value );
139
140 protected:
141 virtual void setPosition( const QPoint & );
142 virtual void valueChange();
143
144 virtual void timerEvent( QTimerEvent *e );
145 virtual void mousePressEvent( QMouseEvent *e );
146 virtual void mouseReleaseEvent( QMouseEvent *e );
147 virtual void mouseMoveEvent( QMouseEvent *e );
148 virtual void keyPressEvent( QKeyEvent *e );
149 virtual void wheelEvent( QWheelEvent *e );
150
159 virtual double getValue( const QPoint & p ) = 0;
160
173 virtual void getScrollMode( const QPoint &pos,
174 ScrollMode &scrollMode, int &direction ) const = 0;
175
176 void setMouseOffset( double );
177 double mouseOffset() const;
178
179 int scrollMode() const;
180
181 private:
182 void buttonReleased();
183
184 class PrivateData;
185 PrivateData *d_data;
186 };
187
188 #endif