Qwt User's Guide 5.2.3

- 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 <qwidget.h>
14 #include "qwt_global.h"
15 #include "qwt_double_range.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 #ifndef Q_MOC_RUN // Qt3 moc
35 #define QWT_PROPERTY Q_PROPERTY
36 Q_PROPERTY( Orientation orientation
37 READ orientation WRITE setOrientation )
38 #else // Qt4 moc
39 // MOC_SKIP_BEGIN
40 Q_PROPERTY( Qt::Orientation orientation
41 READ orientation WRITE setOrientation )
42 // MOC_SKIP_END
43 #endif
44
45 public:
50 enum ScrollMode
51 {
52 ScrNone,
53 ScrMouse,
54 ScrTimer,
55 ScrDirect,
56 ScrPage
57 };
58
59 explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL);
60 virtual ~QwtAbstractSlider();
61
62 void setUpdateTime(int t);
63 void stopMoving();
64 void setTracking(bool enable);
65
66 virtual void setMass(double val);
67 virtual double mass() const;
68
69 #if QT_VERSION >= 0x040000
70 virtual void setOrientation(Qt::Orientation o);
71 Qt::Orientation orientation() const;
72 #else
73 virtual void setOrientation(Orientation o);
74 Orientation orientation() const;
75 #endif
76
77 bool isReadOnly() const;
78
79 /*
80 Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made
81 to be available as Q_PROPERTY in the designer.
82 */
83
87 bool isValid() const { return QwtDoubleRange::isValid(); }
88
93 void setValid(bool valid) { QwtDoubleRange::setValid(valid); }
94
95 public slots:
96 virtual void setValue(double val);
97 virtual void fitValue(double val);
98 virtual void incValue(int steps);
99
100 virtual void setReadOnly(bool);
101
102 signals:
103
112 void valueChanged(double value);
113
118 void sliderPressed();
119
125 void sliderReleased();
131 void sliderMoved(double value);
132
133 protected:
134 virtual void setPosition(const QPoint &);
135 virtual void valueChange();
136
137 virtual void timerEvent(QTimerEvent *e);
138 virtual void mousePressEvent(QMouseEvent *e);
139 virtual void mouseReleaseEvent(QMouseEvent *e);
140 virtual void mouseMoveEvent(QMouseEvent *e);
141 virtual void keyPressEvent(QKeyEvent *e);
142 virtual void wheelEvent(QWheelEvent *e);
143
152 virtual double getValue(const QPoint & p) = 0;
178 virtual void getScrollMode( const QPoint &p,
179 int &scrollMode, int &direction) = 0;
180
181 void setMouseOffset(double);
182 double mouseOffset() const;
183
184 int scrollMode() const;
185
186 private:
187 void buttonReleased();
188
189 class PrivateData;
190 PrivateData *d_data;
191 };
192
193 #endif