File indexing completed on 2024-05-19 15:27:52
0001 /* This file is part of KGraphViewer. 0002 Copyright (C) 2005-2007 Gael de Chalendar <kleag@free.fr> 0003 0004 KGraphViewer is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU General Public 0006 License as published by the Free Software Foundation, version 2. 0007 0008 This program is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 General Public License for more details. 0012 0013 You should have received a copy of the GNU General Public License 0014 along with this program; if not, write to the Free Software 0015 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0016 02110-1301, USA 0017 */ 0018 0019 /* This file was callgraphview.h, part of KCachegrind. 0020 Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> 0021 0022 KCachegrind is free software; you can redistribute it and/or 0023 modify it under the terms of the GNU General Public 0024 License as published by the Free Software Foundation, version 2. 0025 */ 0026 0027 /* 0028 * Callgraph View 0029 */ 0030 0031 #ifndef PANNER_VIEW_H 0032 #define PANNER_VIEW_H 0033 0034 #include <QGraphicsView> 0035 #include <QWidget> 0036 // Added by qt3to4: 0037 #include <QMouseEvent> 0038 0039 namespace KGraphViewer 0040 { 0041 class DotGraphView; 0042 0043 /** 0044 * A panner laid over a QCanvas 0045 */ 0046 class PannerView : public QGraphicsView 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 explicit PannerView(DotGraphView *parent); 0052 0053 inline void setDrawingEnabled(bool val) 0054 { 0055 m_drawContents = val; 0056 } 0057 0058 public Q_SLOTS: 0059 void setZoomRect(QRectF r); 0060 void moveZoomRectTo(const QPointF &newPos, const bool notify = true); 0061 0062 Q_SIGNALS: 0063 void zoomRectMovedTo(QPointF newPos); 0064 void zoomRectMoveFinished(); 0065 0066 protected: 0067 void mousePressEvent(QMouseEvent *) override; 0068 void mouseMoveEvent(QMouseEvent *) override; 0069 void mouseReleaseEvent(QMouseEvent *) override; 0070 void drawForeground(QPainter *p, const QRectF &rect) override; 0071 void contextMenuEvent(QContextMenuEvent *event) override; 0072 0073 QRectF m_zoomRect; 0074 bool m_movingZoomRect; 0075 QPointF m_lastPos; 0076 bool m_drawContents; 0077 DotGraphView *m_parent; 0078 }; 0079 0080 } 0081 0082 #endif