Engauge Digitizer  2
SegmentLine.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef SEGMENT_LINE_H
8 #define SEGMENT_LINE_H
9 
10 #include "DocumentModelSegments.h"
11 #include <QGraphicsLineItem>
12 
13 class QGraphicsScene;
14 class Segment;
15 
17 class SegmentLine : public QObject, public QGraphicsLineItem
18 {
19  Q_OBJECT;
20 
21 public:
23  SegmentLine(QGraphicsScene &scene,
24  const DocumentModelSegments &modelSegments,
25  Segment *segment);
26  ~SegmentLine();
27 
29  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
30 
32  virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
33 
35  virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
36 
38  Segment *segment() const;
39 
41  void setHover (bool hover);
42 
44  void updateModelSegment(const DocumentModelSegments &modelSegments);
45 
46 signals:
48  void signalHover (bool);
49 
50 private:
51  SegmentLine();
52 
53  DocumentModelSegments m_modelSegments;
54  Segment *m_segment;
55 };
56 
57 #endif // SEGMENT_LINE_H
void signalHover(bool)
Pass hover enter/leave events to Segment that owns this.
void updateModelSegment(const DocumentModelSegments &modelSegments)
Update this segment line with new settings.
Definition: SegmentLine.cpp:88
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Highlight this and all other SegmentLines belonging to the same Segment upon hover enter...
Definition: SegmentLine.cpp:46
Segment * segment() const
Segment that owns this line.
Definition: SegmentLine.cpp:67
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Create points along this curve.
Definition: SegmentLine.cpp:60
Selectable piecewise-defined line that follows a filtered line in the image.
Definition: Segment.h:21
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Unset highlighting triggered by hover enter.
Definition: SegmentLine.cpp:53
Model for DlgSettingsSegments and CmdSettingsSegments.
This class is a special case of the standard QGraphicsLineItem for segments.
Definition: SegmentLine.h:17
void setHover(bool hover)
Apply/remove highlighting triggered by hover enter/leave.
Definition: SegmentLine.cpp:72