1 /******************************************************************* 2 3 Part of the Fritzing project - http://fritzing.org 4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de 5 6 Fritzing is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 Fritzing is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Fritzing. If not, see <http://www.gnu.org/licenses/>. 18 19 ******************************************************************** 20 21 $Revision: 6904 $: 22 $Author: irascibl@gmail.com $: 23 $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $ 24 25 ********************************************************************/ 26 27 #ifndef RESIZEHANDLE_H 28 #define RESIZEHANDLE_H 29 30 #include <QGraphicsPixmapItem> 31 #include <QGraphicsSceneMouseEvent> 32 33 // currently used by Note.cpp 34 35 class ResizeHandle : public QObject, public QGraphicsPixmapItem 36 { 37 Q_OBJECT 38 39 public: 40 ResizeHandle(const QPixmap & pixmap, const QCursor &, bool ignoresTransforms, QGraphicsItem * parent = 0); 41 ~ResizeHandle(); 42 43 QPointF resizeOffset(); 44 void setResizeOffset(QPointF); 45 double currentScale(); 46 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 47 48 public slots: 49 void zoomChangedSlot(double scale); 50 51 protected: 52 void mousePressEvent ( QGraphicsSceneMouseEvent * event ); 53 void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); 54 void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); 55 QVariant itemChange(GraphicsItemChange change, const QVariant &value); 56 bool scaling(); 57 58 signals: 59 void mousePressSignal(QGraphicsSceneMouseEvent * event, ResizeHandle *); 60 void mouseMoveSignal(QGraphicsSceneMouseEvent * event, ResizeHandle *); 61 void mouseReleaseSignal(QGraphicsSceneMouseEvent * event, ResizeHandle *); 62 void zoomChangedSignal(double scale); 63 64 protected: 65 QPointF m_resizeOffset; 66 67 }; 68 69 #endif 70