Mercurial > hg > easyhg
annotate panned.h @ 132:16ceeee30e2a
* Ensure panned rect stays current when size changes; update panner cache when scene changes
author | Chris Cannam |
---|---|
date | Tue, 30 Nov 2010 11:41:46 +0000 |
parents | f583e44d9d31 |
children | aaeab914f2a3 |
rev | line source |
---|---|
Chris@57 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
cannam@45 | 2 |
cannam@45 | 3 /* |
Chris@57 | 4 EasyMercurial |
Chris@57 | 5 |
Chris@57 | 6 Based on HgExplorer by Jari Korhonen |
Chris@57 | 7 Copyright (c) 2010 Jari Korhonen |
Chris@57 | 8 Copyright (c) 2010 Chris Cannam |
Chris@57 | 9 Copyright (c) 2010 Queen Mary, University of London |
Chris@57 | 10 |
cannam@45 | 11 This program is free software; you can redistribute it and/or |
cannam@45 | 12 modify it under the terms of the GNU General Public License as |
cannam@45 | 13 published by the Free Software Foundation; either version 2 of the |
cannam@45 | 14 License, or (at your option) any later version. See the file |
cannam@45 | 15 COPYING included with this distribution for more information. |
cannam@45 | 16 */ |
cannam@45 | 17 |
Chris@57 | 18 #ifndef _PANNED_H_ |
Chris@57 | 19 #define _PANNED_H_ |
cannam@45 | 20 |
cannam@45 | 21 #include <QGraphicsView> |
cannam@45 | 22 |
cannam@45 | 23 class QWheelEvent; |
cannam@45 | 24 class QEvent; |
cannam@45 | 25 |
cannam@45 | 26 class Panned : public QGraphicsView |
cannam@45 | 27 { |
cannam@45 | 28 Q_OBJECT |
cannam@45 | 29 |
cannam@45 | 30 public: |
cannam@45 | 31 Panned(); |
cannam@45 | 32 virtual ~Panned() { } |
cannam@45 | 33 |
cannam@45 | 34 signals: |
cannam@45 | 35 void pannedRectChanged(QRectF); |
cannam@45 | 36 void wheelEventReceived(QWheelEvent *); |
cannam@45 | 37 void pannedContentsScrolled(); |
cannam@45 | 38 void mouseLeaves(); |
cannam@45 | 39 |
cannam@45 | 40 public slots: |
cannam@45 | 41 void slotSetPannedRect(QRectF); |
cannam@45 | 42 void slotEmulateWheelEvent(QWheelEvent *ev); |
cannam@45 | 43 |
Chris@53 | 44 void zoomIn(); |
Chris@53 | 45 void zoomOut(); |
Chris@53 | 46 |
cannam@45 | 47 protected: |
cannam@45 | 48 QRectF m_pannedRect; |
cannam@45 | 49 |
cannam@45 | 50 virtual void paintEvent(QPaintEvent *); |
cannam@45 | 51 virtual void resizeEvent(QResizeEvent *); |
cannam@45 | 52 virtual void drawForeground(QPainter *, const QRectF &); |
cannam@45 | 53 virtual void wheelEvent(QWheelEvent *); |
cannam@45 | 54 virtual void leaveEvent(QEvent *); |
cannam@45 | 55 }; |
cannam@45 | 56 |
cannam@45 | 57 #endif |
cannam@45 | 58 |