##// END OF EJS Templates
Add missing include for QObject...
Samuli Piippo -
r2731:450ab64fa5cd
parent child
Show More
@@ -1,109 +1,110
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2014 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef SCROLLER_P_H
31 31 #define SCROLLER_P_H
32 32
33 33 #include <QtCharts/QChartGlobal>
34 #include <QtCore/QObject>
34 35 #include <QtCore/QBasicTimer>
35 36 #include <QtCore/QTime>
36 37 #include <QtCore/QPointF>
37 38
38 39 class QGraphicsSceneMouseEvent;
39 40
40 41 QT_CHARTS_BEGIN_NAMESPACE
41 42
42 43 class Scroller;
43 44 class QLegend;
44 45
45 46 class ScrollTicker : public QObject
46 47 {
47 48 Q_OBJECT
48 49 public:
49 50 explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
50 51 void start(int interval);
51 52 void stop();
52 53 protected:
53 54 void timerEvent(QTimerEvent *event);
54 55
55 56 private:
56 57 QBasicTimer m_timer;
57 58 Scroller *m_scroller;
58 59 };
59 60
60 61 class Scroller
61 62 {
62 63 public:
63 64 enum State {
64 65 Idle,
65 66 Pressed,
66 67 Move,
67 68 Scroll
68 69 };
69 70
70 71 Scroller();
71 72 virtual ~Scroller();
72 73
73 74 virtual void setOffset(const QPointF &point) = 0;
74 75 virtual QPointF offset() const = 0;
75 76
76 77 void move(const QPointF &delta);
77 78 void scrollTo(const QPointF &delta);
78 79
79 80 void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
80 81 void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
81 82 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
82 83
83 84 void scrollTick();
84 85
85 86 private:
86 87 void startTicker(int interval);
87 88 void stopTicker();
88 89
89 90 private:
90 91 void calculateSpeed(const QPointF &position);
91 92 void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
92 93
93 94 private:
94 95 ScrollTicker m_ticker;
95 96 QTime m_timeStamp;
96 97 QPointF m_speed;
97 98 QPointF m_fraction;
98 99 int m_timeTresholdMin;
99 100 int m_timeTresholdMax;
100 101
101 102 State m_state;
102 103 QPointF m_pressPos;
103 104 QPointF m_lastPos;
104 105 qreal m_treshold;
105 106 };
106 107
107 108 QT_CHARTS_END_NAMESPACE
108 109
109 110 #endif /* SCROLLER_P_H */
General Comments 0
You need to be logged in to leave comments. Login now