Mercurial > hg > easyhg
comparison src/panned.h @ 370:b9c153e00e84
Move source files to src/
author | Chris Cannam |
---|---|
date | Thu, 24 Mar 2011 10:27:51 +0000 |
parents | panned.h@8fd71f570884 |
children | 44cef6368690 |
comparison
equal
deleted
inserted
replaced
369:19cce6d2c470 | 370:b9c153e00e84 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 EasyMercurial | |
5 | |
6 Based on HgExplorer by Jari Korhonen | |
7 Copyright (c) 2010 Jari Korhonen | |
8 Copyright (c) 2011 Chris Cannam | |
9 Copyright (c) 2011 Queen Mary, University of London | |
10 | |
11 This program is free software; you can redistribute it and/or | |
12 modify it under the terms of the GNU General Public License as | |
13 published by the Free Software Foundation; either version 2 of the | |
14 License, or (at your option) any later version. See the file | |
15 COPYING included with this distribution for more information. | |
16 */ | |
17 | |
18 #ifndef _PANNED_H_ | |
19 #define _PANNED_H_ | |
20 | |
21 #include <QGraphicsView> | |
22 | |
23 class QWheelEvent; | |
24 class QEvent; | |
25 class QTimer; | |
26 | |
27 class Panned : public QGraphicsView | |
28 { | |
29 Q_OBJECT | |
30 | |
31 public: | |
32 Panned(); | |
33 virtual ~Panned() { } | |
34 | |
35 virtual void setScene(QGraphicsScene *s); | |
36 | |
37 signals: | |
38 void pannedRectChanged(QRectF); | |
39 void wheelEventReceived(QWheelEvent *); | |
40 void pannedContentsScrolled(); | |
41 void mouseLeaves(); | |
42 | |
43 public slots: | |
44 void slotSetPannedRect(QRectF); | |
45 void slotEmulateWheelEvent(QWheelEvent *ev); | |
46 | |
47 void zoomIn(); | |
48 void zoomOut(); | |
49 | |
50 private slots: | |
51 void dragTimerTimeout(); | |
52 | |
53 protected: | |
54 QRectF m_pannedRect; | |
55 | |
56 QPoint m_lastDragPos; | |
57 QPoint m_lastOrigin; | |
58 QPointF m_velocity; | |
59 bool m_dragging; | |
60 int m_dragTimerMs; | |
61 QTimer *m_dragTimer; | |
62 | |
63 virtual void mousePressEvent(QMouseEvent *); | |
64 virtual void mouseMoveEvent(QMouseEvent *); | |
65 virtual void mouseReleaseEvent(QMouseEvent *); | |
66 | |
67 virtual void paintEvent(QPaintEvent *); | |
68 virtual void resizeEvent(QResizeEvent *); | |
69 virtual void drawForeground(QPainter *, const QRectF &); | |
70 virtual void wheelEvent(QWheelEvent *); | |
71 virtual void leaveEvent(QEvent *); | |
72 }; | |
73 | |
74 #endif | |
75 |