00001 /****************************************************************************************************** 00002 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * 00003 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * 00004 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * 00005 ******************************************************************************************************/ 00006 00007 #ifndef GRAPHICS_POINT_POLYGON_H 00008 #define GRAPHICS_POINT_POLYGON_H 00009 00010 #include <QGraphicsPolygonItem> 00011 #include <QObject> 00012 #include <QPointF> 00013 00014 class GraphicsPoint; 00015 00017 class GraphicsPointPolygon : public QObject, public QGraphicsPolygonItem 00018 { 00019 Q_OBJECT; 00020 00021 public: 00023 GraphicsPointPolygon(GraphicsPoint &graphicsPoint, 00024 const QPolygonF &polygon); 00025 00027 QVariant itemChange(GraphicsItemChange change, const QVariant &value); 00028 00030 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); 00031 00033 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); 00034 00036 void setRadius(int radius); 00037 00039 void setShadow (GraphicsPointPolygon *shadow); 00040 00041 signals: 00042 00044 void signalPointHoverEnter (QString); 00045 00047 void signalPointHoverLeave (QString); 00048 00049 private: 00050 GraphicsPointPolygon(); 00051 00052 void setOpacityForSubtree (double opacity); 00053 00054 // Reference to the GraphicsPoint that this class belongs to 00055 GraphicsPoint &m_graphicsPoint; 00056 00057 GraphicsPointPolygon *m_shadow; 00058 }; 00059 00060 #endif // GRAPHICS_POINT_POLYGON_H