Changeset View
Changeset View
Standalone View
Standalone View
src/part/pannerview.h
Show All 18 Lines | |||||
19 | /* This file was callgraphview.h, part of KCachegrind. | 19 | /* This file was callgraphview.h, part of KCachegrind. | ||
20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | 20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | ||
21 | 21 | | |||
22 | KCachegrind is free software; you can redistribute it and/or | 22 | KCachegrind is free software; you can redistribute it and/or | ||
23 | modify it under the terms of the GNU General Public | 23 | modify it under the terms of the GNU General Public | ||
24 | License as published by the Free Software Foundation, version 2. | 24 | License as published by the Free Software Foundation, version 2. | ||
25 | */ | 25 | */ | ||
26 | 26 | | |||
27 | | ||||
28 | /* | 27 | /* | ||
29 | * Callgraph View | 28 | * Callgraph View | ||
30 | */ | 29 | */ | ||
31 | 30 | | |||
32 | #ifndef PANNER_VIEW_H | 31 | #ifndef PANNER_VIEW_H | ||
33 | #define PANNER_VIEW_H | 32 | #define PANNER_VIEW_H | ||
34 | 33 | | |||
35 | #include <QGraphicsView> | 34 | #include <QGraphicsView> | ||
36 | #include <QWidget> | 35 | #include <QWidget> | ||
37 | //Added by qt3to4: | 36 | // Added by qt3to4: | ||
38 | #include <QMouseEvent> | 37 | #include <QMouseEvent> | ||
39 | 38 | | |||
40 | namespace KGraphViewer | 39 | namespace KGraphViewer | ||
41 | { | 40 | { | ||
42 | | ||||
43 | class DotGraphView; | 41 | class DotGraphView; | ||
44 | 42 | | |||
45 | /** | 43 | /** | ||
46 | * A panner laid over a QCanvas | 44 | * A panner laid over a QCanvas | ||
47 | */ | 45 | */ | ||
48 | class PannerView: public QGraphicsView | 46 | class PannerView : public QGraphicsView | ||
49 | { | 47 | { | ||
50 | Q_OBJECT | 48 | Q_OBJECT | ||
51 | 49 | | |||
52 | public: | 50 | public: | ||
53 | explicit PannerView(DotGraphView * parent); | 51 | explicit PannerView(DotGraphView *parent); | ||
54 | 52 | | |||
55 | inline void setDrawingEnabled(bool val) {m_drawContents = val;} | 53 | inline void setDrawingEnabled(bool val) | ||
54 | { | ||||
55 | m_drawContents = val; | ||||
56 | } | ||||
56 | 57 | | |||
57 | public Q_SLOTS: | 58 | public Q_SLOTS: | ||
58 | void setZoomRect(QRectF r); | 59 | void setZoomRect(QRectF r); | ||
59 | void moveZoomRectTo(const QPointF& newPos, const bool notify = true); | 60 | void moveZoomRectTo(const QPointF &newPos, const bool notify = true); | ||
60 | 61 | | |||
61 | Q_SIGNALS: | 62 | Q_SIGNALS: | ||
62 | void zoomRectMovedTo(QPointF newPos); | 63 | void zoomRectMovedTo(QPointF newPos); | ||
63 | void zoomRectMoveFinished(); | 64 | void zoomRectMoveFinished(); | ||
64 | 65 | | |||
65 | protected: | 66 | protected: | ||
66 | void mousePressEvent(QMouseEvent*) override; | 67 | void mousePressEvent(QMouseEvent *) override; | ||
67 | void mouseMoveEvent(QMouseEvent*) override; | 68 | void mouseMoveEvent(QMouseEvent *) override; | ||
68 | void mouseReleaseEvent(QMouseEvent*) override; | 69 | void mouseReleaseEvent(QMouseEvent *) override; | ||
69 | void drawForeground(QPainter* p, const QRectF& rect) override; | 70 | void drawForeground(QPainter *p, const QRectF &rect) override; | ||
70 | void contextMenuEvent(QContextMenuEvent* event) override; | 71 | void contextMenuEvent(QContextMenuEvent *event) override; | ||
71 | 72 | | |||
72 | QRectF m_zoomRect; | 73 | QRectF m_zoomRect; | ||
73 | bool m_movingZoomRect; | 74 | bool m_movingZoomRect; | ||
74 | QPointF m_lastPos; | 75 | QPointF m_lastPos; | ||
75 | bool m_drawContents; | 76 | bool m_drawContents; | ||
76 | DotGraphView* m_parent; | 77 | DotGraphView *m_parent; | ||
77 | }; | 78 | }; | ||
78 | 79 | | |||
79 | } | 80 | } | ||
80 | 81 | | |||
81 | #endif | 82 | #endif | ||
82 | | ||||
83 | | ||||
84 | |