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 SEGMENT_LINE_H 00008 #define SEGMENT_LINE_H 00009 00010 #include "DocumentModelSegments.h" 00011 #include <QGraphicsLineItem> 00012 00013 class QGraphicsScene; 00014 class Segment; 00015 00017 class SegmentLine : public QObject, public QGraphicsLineItem 00018 { 00019 Q_OBJECT; 00020 00021 public: 00023 SegmentLine(QGraphicsScene &scene, 00024 const DocumentModelSegments &modelSegments, 00025 Segment *segment); 00026 ~SegmentLine(); 00027 00029 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); 00030 00032 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); 00033 00035 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); 00036 00038 Segment *segment() const; 00039 00041 void setHover (bool hover); 00042 00044 void updateModelSegment(const DocumentModelSegments &modelSegments); 00045 00046 signals: 00048 void signalHover (bool); 00049 00050 private: 00051 SegmentLine(); 00052 00053 DocumentModelSegments m_modelSegments; 00054 Segment *m_segment; 00055 }; 00056 00057 #endif // SEGMENT_LINE_H