Changeset View
Changeset View
Standalone View
Standalone View
src/part/canvasedge.cpp
Show All 18 Lines | |||||
19 | /* This file was callgraphview.cpp, part of KCachegrind. | 19 | /* This file was callgraphview.cpp, part of KCachegrind. | ||
20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | 20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | ||
21 | 21 | | |||
22 | KCachegrind is free software; you can redistribute it and/or | 22 | KCachegrind is free software; you can redistribute it and/or | ||
23 | modify it under the terms of the GNU General Public | 23 | modify it under the terms of the GNU General Public | ||
24 | License as published by the Free Software Foundation, version 2. | 24 | License as published by the Free Software Foundation, version 2. | ||
25 | */ | 25 | */ | ||
26 | 26 | | |||
27 | | ||||
28 | #include "canvasedge.h" | 27 | #include "canvasedge.h" | ||
29 | #include "graphedge.h" | 28 | #include "FontsCache.h" | ||
30 | #include "graphnode.h" | | |||
31 | #include "dotdefaults.h" | | |||
32 | #include "dot2qtconsts.h" | 29 | #include "dot2qtconsts.h" | ||
30 | #include "dotdefaults.h" | ||||
33 | #include "dotgraphview.h" | 31 | #include "dotgraphview.h" | ||
34 | #include "FontsCache.h" | 32 | #include "graphedge.h" | ||
33 | #include "graphnode.h" | ||||
35 | #include "kgraphviewerlib_debug.h" | 34 | #include "kgraphviewerlib_debug.h" | ||
36 | 35 | | |||
37 | #include <QAction> | 36 | #include <QAction> | ||
38 | 37 | | |||
39 | #include <QPainter> | | |||
40 | #include <QGraphicsSceneMouseEvent> | 38 | #include <QGraphicsSceneMouseEvent> | ||
41 | #include <QMenu> | 39 | #include <QMenu> | ||
40 | #include <QPainter> | ||||
42 | 41 | | |||
43 | #include <klocalizedstring.h> | 42 | #include <klocalizedstring.h> | ||
44 | 43 | | |||
45 | #include <iostream> | 44 | #include <iostream> | ||
46 | 45 | | |||
47 | // | 46 | // | ||
48 | // CanvasEdge | 47 | // CanvasEdge | ||
49 | // | 48 | // | ||
50 | 49 | | |||
51 | namespace KGraphViewer | 50 | namespace KGraphViewer | ||
52 | { | 51 | { | ||
53 | 52 | CanvasEdge::CanvasEdge(DotGraphView *view, GraphEdge *e, qreal scaleX, qreal scaleY, qreal xMargin, qreal yMargin, qreal gh, qreal wdhcf, qreal hdvcf, QGraphicsItem *parent) | |||
54 | CanvasEdge::CanvasEdge(DotGraphView* view, GraphEdge* e, | 53 | : QAbstractGraphicsShapeItem(parent) | ||
55 | qreal scaleX, qreal scaleY, | 54 | , m_scaleX(scaleX) | ||
56 | qreal xMargin, qreal yMargin, qreal gh, | 55 | , m_scaleY(scaleY) | ||
57 | qreal wdhcf, qreal hdvcf, | 56 | , m_xMargin(xMargin) | ||
58 | QGraphicsItem* parent) | 57 | , m_yMargin(yMargin) | ||
59 | : QAbstractGraphicsShapeItem(parent), | 58 | , m_gh(/*gh*/ 0) | ||
60 | m_scaleX(scaleX), m_scaleY(scaleY), | 59 | , m_wdhcf(wdhcf) | ||
61 | m_xMargin(xMargin), m_yMargin(yMargin), | 60 | , m_hdvcf(hdvcf) | ||
62 | m_gh(/*gh*/0), m_wdhcf(wdhcf), m_hdvcf(hdvcf), m_edge(e), | 61 | , m_edge(e) | ||
63 | m_font(nullptr), m_view(view), m_popup(new QMenu()) | 62 | , m_font(nullptr) | ||
63 | , m_view(view) | ||||
64 | , m_popup(new QMenu()) | ||||
64 | { | 65 | { | ||
65 | Q_UNUSED(gh); | 66 | Q_UNUSED(gh); | ||
66 | qCDebug(KGRAPHVIEWERLIB_LOG) << "edge " << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << m_gh; | 67 | qCDebug(KGRAPHVIEWERLIB_LOG) << "edge " << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << m_gh; | ||
67 | setBoundingRegionGranularity(0.9); | 68 | setBoundingRegionGranularity(0.9); | ||
68 | m_font = FontsCache::changeable().fromName(e->fontName()); | 69 | m_font = FontsCache::changeable().fromName(e->fontName()); | ||
69 | 70 | | |||
70 | computeBoundingRect(); | 71 | computeBoundingRect(); | ||
71 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "boundingRect computed: " << m_boundingRect; | 72 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "boundingRect computed: " << m_boundingRect; | ||
72 | 73 | | |||
73 | QString tipStr = i18n("%1 -> %2\nlabel='%3'", | 74 | QString tipStr = i18n("%1 -> %2\nlabel='%3'", edge()->fromNode()->id(), edge()->toNode()->id(), e->label()); | ||
74 | edge()->fromNode()->id(),edge()->toNode()->id(),e->label()); | | |||
75 | setToolTip(tipStr); | 75 | setToolTip(tipStr); | ||
76 | 76 | | |||
77 | // the message should be given (or possible to be given) by the part user | 77 | // the message should be given (or possible to be given) by the part user | ||
78 | QAction* removeEdgeAction = new QAction(i18n("Remove selected edge(s)"), this); | 78 | QAction *removeEdgeAction = new QAction(i18n("Remove selected edge(s)"), this); | ||
79 | m_popup->addAction(removeEdgeAction); | 79 | m_popup->addAction(removeEdgeAction); | ||
80 | connect(removeEdgeAction, &QAction::triggered, | 80 | connect(removeEdgeAction, &QAction::triggered, this, &CanvasEdge::slotRemoveEdge); | ||
81 | this, &CanvasEdge::slotRemoveEdge); | | |||
82 | | ||||
83 | 81 | | |||
84 | connect(e, &GraphEdge::changed, | 82 | connect(e, &GraphEdge::changed, this, &CanvasEdge::modelChanged); | ||
85 | this, &CanvasEdge::modelChanged); | 83 | connect(this, &CanvasEdge::selected, view, &DotGraphView::slotEdgeSelected); | ||
86 | connect(this, &CanvasEdge::selected, | | |||
87 | view, &DotGraphView::slotEdgeSelected); | | |||
88 | 84 | | |||
89 | connect(this, &CanvasEdge::edgeContextMenuEvent, | 85 | connect(this, &CanvasEdge::edgeContextMenuEvent, view, &DotGraphView::slotContextMenuEvent); | ||
90 | view, &DotGraphView::slotContextMenuEvent); | | |||
91 | 86 | | |||
92 | setAcceptHoverEvents ( true ); | 87 | setAcceptHoverEvents(true); | ||
93 | 88 | | |||
94 | qCDebug(KGRAPHVIEWERLIB_LOG) << "connect slotElementHoverEnter"; | 89 | qCDebug(KGRAPHVIEWERLIB_LOG) << "connect slotElementHoverEnter"; | ||
95 | connect(this, &CanvasEdge::hoverEnter, | 90 | connect(this, &CanvasEdge::hoverEnter, view, static_cast<void (DotGraphView::*)(CanvasEdge *)>(&DotGraphView::slotElementHoverEnter)); | ||
96 | view, static_cast<void(DotGraphView::*)(CanvasEdge*)>(&DotGraphView::slotElementHoverEnter)); | 91 | connect(this, &CanvasEdge::hoverLeave, view, static_cast<void (DotGraphView::*)(CanvasEdge *)>(&DotGraphView::slotElementHoverLeave)); | ||
97 | connect(this, &CanvasEdge::hoverLeave, | | |||
98 | view, static_cast<void(DotGraphView::*)(CanvasEdge*)>(&DotGraphView::slotElementHoverLeave)); | | |||
99 | } | 92 | } | ||
100 | 93 | | |||
101 | CanvasEdge::~CanvasEdge() | 94 | CanvasEdge::~CanvasEdge() | ||
102 | { | 95 | { | ||
103 | delete m_popup; | 96 | delete m_popup; | ||
104 | } | 97 | } | ||
105 | 98 | | |||
106 | | ||||
107 | QRectF CanvasEdge::boundingRect() const | 99 | QRectF CanvasEdge::boundingRect() const | ||
108 | { | 100 | { | ||
109 | return m_boundingRect; | 101 | return m_boundingRect; | ||
110 | } | 102 | } | ||
111 | 103 | | |||
112 | QPainterPath CanvasEdge::shape () const | 104 | QPainterPath CanvasEdge::shape() const | ||
113 | { | 105 | { | ||
114 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id(); | 106 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id(); | ||
115 | 107 | | |||
116 | if (!m_shape.isEmpty()) { | 108 | if (!m_shape.isEmpty()) { | ||
117 | return m_shape; | 109 | return m_shape; | ||
118 | } | 110 | } | ||
119 | 111 | | |||
120 | foreach (const DotRenderOp& dro, edge()->renderOperations()) | 112 | foreach (const DotRenderOp &dro, edge()->renderOperations()) { | ||
121 | { | 113 | if (dro.renderop == "B") { | ||
122 | if ( dro.renderop == "B" ) | 114 | for (int splineNum = 0; splineNum < edge()->colors().count() || (splineNum == 0 && edge()->colors().count() == 0); splineNum++) { | ||
123 | { | | |||
124 | for (int splineNum = 0; splineNum < edge()->colors().count() || (splineNum==0 && edge()->colors().count()==0); splineNum++) | | |||
125 | { | | |||
126 | m_shape.addPath(pathForSpline(splineNum, dro)); | 115 | m_shape.addPath(pathForSpline(splineNum, dro)); | ||
127 | } | 116 | } | ||
128 | } | 117 | } | ||
129 | } | 118 | } | ||
130 | return m_shape; | 119 | return m_shape; | ||
131 | } | 120 | } | ||
132 | 121 | | |||
133 | QPainterPath CanvasEdge::pathForSpline(int splineNum, const DotRenderOp& dro) const | 122 | QPainterPath CanvasEdge::pathForSpline(int splineNum, const DotRenderOp &dro) const | ||
134 | { | 123 | { | ||
135 | QPolygonF points(dro.integers[0]); | 124 | QPolygonF points(dro.integers[0]); | ||
136 | for (int i = 0; i < dro.integers[0]; i++) | 125 | for (int i = 0; i < dro.integers[0]; i++) { | ||
137 | { | | |||
138 | // computing of diffX and diffY to draw parallel edges | 126 | // computing of diffX and diffY to draw parallel edges | ||
139 | // when asked through the corresponding Graphviz feature | 127 | // when asked through the corresponding Graphviz feature | ||
140 | qreal nom = (dro.integers[2*dro.integers[0]]-dro.integers[2]); | 128 | qreal nom = (dro.integers[2 * dro.integers[0]] - dro.integers[2]); | ||
141 | qreal denom = (dro.integers[2*dro.integers[0]-1]-dro.integers[1]); | 129 | qreal denom = (dro.integers[2 * dro.integers[0] - 1] - dro.integers[1]); | ||
142 | qreal diffX, diffY; | 130 | qreal diffX, diffY; | ||
143 | if (nom == 0) | 131 | if (nom == 0) { | ||
144 | { | | |||
145 | diffX = 0; | 132 | diffX = 0; | ||
146 | diffY = 2*(edge()->colors().count()/2 - splineNum); | 133 | diffY = 2 * (edge()->colors().count() / 2 - splineNum); | ||
147 | } | 134 | } else if (denom == 0) { | ||
148 | else if (denom ==0) | | |||
149 | { | | |||
150 | diffX = 2*(edge()->colors().count()/2 - splineNum); | 135 | diffX = 2 * (edge()->colors().count() / 2 - splineNum); | ||
151 | diffY = 0; | 136 | diffY = 0; | ||
152 | } | 137 | } else { | ||
153 | else | | |||
154 | { | | |||
155 | double pente = nom/denom; | 138 | double pente = nom / denom; | ||
156 | if (pente < 0) | 139 | if (pente < 0) { | ||
157 | { | | |||
158 | diffX = 2*(edge()->colors().count()/2 - splineNum); | 140 | diffX = 2 * (edge()->colors().count() / 2 - splineNum); | ||
159 | diffY = edge()->colors().count()/2 + splineNum; | 141 | diffY = edge()->colors().count() / 2 + splineNum; | ||
160 | } | 142 | } else { | ||
161 | else | | |||
162 | { | | |||
163 | diffX = 2*(edge()->colors().count()/2 - splineNum); | 143 | diffX = 2 * (edge()->colors().count() / 2 - splineNum); | ||
164 | diffY = 2*(edge()->colors().count()/2 - splineNum); | 144 | diffY = 2 * (edge()->colors().count() / 2 - splineNum); | ||
165 | } | 145 | } | ||
166 | } | 146 | } | ||
167 | QPointF p( | 147 | QPointF p((dro.integers[2 * i + 1] /*%m_wdhcf*/ * m_scaleX) + m_xMargin + diffX, (m_gh - dro.integers[2 * i + 2] /*%m_hdvcf*/) * m_scaleY + m_yMargin + diffY); | ||
168 | (dro.integers[2*i+1]/*%m_wdhcf*/*m_scaleX) +m_xMargin + diffX, | | |||
169 | (m_gh-dro.integers[2*i+2]/*%m_hdvcf*/)*m_scaleY + m_yMargin + diffY | | |||
170 | ); | | |||
171 | points[i] = p; | 148 | points[i] = p; | ||
172 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << p; | 149 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << p; | ||
173 | } | 150 | } | ||
174 | 151 | | |||
175 | QPainterPath path; | 152 | QPainterPath path; | ||
176 | path.moveTo(points[0]); | 153 | path.moveTo(points[0]); | ||
177 | for (int j = 0; j < (points.size()-1)/3; j++) | 154 | for (int j = 0; j < (points.size() - 1) / 3; j++) { | ||
178 | { | | |||
179 | path.cubicTo(points[3*j + 1],points[3*j+1 + 1], points[3*j+2 + 1]); | 155 | path.cubicTo(points[3 * j + 1], points[3 * j + 1 + 1], points[3 * j + 2 + 1]); | ||
180 | } | 156 | } | ||
181 | return path; | 157 | return path; | ||
182 | } | 158 | } | ||
183 | 159 | | |||
184 | 160 | void CanvasEdge::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget) | |||
185 | void CanvasEdge::paint(QPainter* p, const QStyleOptionGraphicsItem* option, | | |||
186 | QWidget* widget) | | |||
187 | { | 161 | { | ||
188 | // qCDebug(KGRAPHVIEWERLIB_LOG); | 162 | // qCDebug(KGRAPHVIEWERLIB_LOG); | ||
189 | Q_UNUSED(option) | 163 | Q_UNUSED(option) | ||
190 | Q_UNUSED(widget) | 164 | Q_UNUSED(widget) | ||
191 | if (m_boundingRect == QRectF()) | 165 | if (m_boundingRect == QRectF()) { | ||
192 | { | | |||
193 | return; | 166 | return; | ||
194 | } | 167 | } | ||
195 | /// computes the scaling of line width | 168 | /// computes the scaling of line width | ||
196 | qreal widthScaleFactor = (m_scaleX+m_scaleY)/2; | 169 | qreal widthScaleFactor = (m_scaleX + m_scaleY) / 2; | ||
197 | if (widthScaleFactor < 1) | 170 | if (widthScaleFactor < 1) { | ||
198 | { | | |||
199 | widthScaleFactor = 1; | 171 | widthScaleFactor = 1; | ||
200 | } | 172 | } | ||
201 | 173 | | |||
202 | if (edge()->style()=="invis") | 174 | if (edge()->style() == "invis") { | ||
203 | { | | |||
204 | return; | 175 | return; | ||
205 | } | 176 | } | ||
206 | if (edge()->renderOperations().isEmpty()) | 177 | if (edge()->renderOperations().isEmpty()) { | ||
207 | { | 178 | if ((edge()->fromNode()->canvasElement()) && (edge()->toNode()->canvasElement())) { | ||
208 | if ((edge()->fromNode()->canvasElement()) | 179 | p->drawLine(edge()->fromNode()->canvasElement()->boundingRect().center() + edge()->fromNode()->canvasElement()->pos(), edge()->toNode()->canvasElement()->boundingRect().center() + edge()->toNode()->canvasElement()->pos()); | ||
209 | && (edge()->toNode()->canvasElement())) | | |||
210 | { | | |||
211 | p->drawLine( | | |||
212 | edge()->fromNode()->canvasElement()->boundingRect().center()+edge()->fromNode()->canvasElement()->pos(), | | |||
213 | edge()->toNode()->canvasElement()->boundingRect().center()+edge()->toNode()->canvasElement()->pos()); | | |||
214 | } | 180 | } | ||
215 | return; | 181 | return; | ||
216 | } | 182 | } | ||
217 | 183 | | |||
218 | QColor lineColor = Dot2QtConsts::componentData().qtColor(edge()->color(0)); | 184 | QColor lineColor = Dot2QtConsts::componentData().qtColor(edge()->color(0)); | ||
219 | QColor backColor; | 185 | QColor backColor; | ||
220 | 186 | | |||
221 | QList<QPointF> allPoints; | 187 | QList<QPointF> allPoints; | ||
222 | 188 | | |||
223 | const QFont oldFont = p->font(); | 189 | const QFont oldFont = p->font(); | ||
224 | const QPen oldPen = p->pen(); | 190 | const QPen oldPen = p->pen(); | ||
225 | const QBrush oldBrush = p->brush(); | 191 | const QBrush oldBrush = p->brush(); | ||
226 | 192 | | |||
227 | foreach (const DotRenderOp& dro, edge()->renderOperations()) | 193 | foreach (const DotRenderOp &dro, edge()->renderOperations()) { | ||
228 | { | | |||
229 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "renderop" << dro.renderop << "; selected:" << edge()->isSelected(); | 194 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "renderop" << dro.renderop << "; selected:" << edge()->isSelected(); | ||
230 | if (dro.renderop == "c") | 195 | if (dro.renderop == "c") { | ||
231 | { | | |||
232 | QColor c(dro.str.mid(0,7)); | 196 | QColor c(dro.str.mid(0, 7)); | ||
233 | bool ok; | 197 | bool ok; | ||
234 | c.setAlpha(255-dro.str.mid(8).toInt(&ok,16)); | 198 | c.setAlpha(255 - dro.str.mid(8).toInt(&ok, 16)); | ||
235 | lineColor = c; | 199 | lineColor = c; | ||
236 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "c" << dro.str.mid(0,7) << lineColor; | 200 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "c" << dro.str.mid(0,7) << lineColor; | ||
237 | } | 201 | } else if (dro.renderop == "C") { | ||
238 | else if (dro.renderop == "C") | | |||
239 | { | | |||
240 | QColor c(dro.str.mid(0,7)); | 202 | QColor c(dro.str.mid(0, 7)); | ||
241 | bool ok; | 203 | bool ok; | ||
242 | c.setAlpha(255-dro.str.mid(8).toInt(&ok,16)); | 204 | c.setAlpha(255 - dro.str.mid(8).toInt(&ok, 16)); | ||
243 | /* if (m_hovered && m_view->highlighting()) | 205 | /* if (m_hovered && m_view->highlighting()) | ||
244 | { | 206 | { | ||
245 | c = c.lighter(); | 207 | c = c.lighter(); | ||
246 | }*/ | 208 | }*/ | ||
247 | backColor = c; | 209 | backColor = c; | ||
248 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "C" << dro.str.mid(0,7) << backColor; | 210 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "C" << dro.str.mid(0,7) << backColor; | ||
249 | } | 211 | } else if (dro.renderop == "T") { | ||
250 | else if ( dro.renderop == "T" ) | | |||
251 | { | | |||
252 | const QString& str = dro.str; | 212 | const QString &str = dro.str; | ||
253 | 213 | | |||
254 | qreal stringWidthGoal = dro.integers[3] * m_scaleX; | 214 | qreal stringWidthGoal = dro.integers[3] * m_scaleX; | ||
255 | int fontSize = edge()->fontSize(); | 215 | int fontSize = edge()->fontSize(); | ||
256 | m_font->setPointSize(fontSize); | 216 | m_font->setPointSize(fontSize); | ||
257 | QFontMetrics fm(*m_font); | 217 | QFontMetrics fm(*m_font); | ||
258 | while (fm.width(str) > stringWidthGoal && fontSize > 1) | 218 | while (fm.width(str) > stringWidthGoal && fontSize > 1) { | ||
259 | { | | |||
260 | fontSize--; | 219 | fontSize--; | ||
261 | m_font->setPointSize(fontSize); | 220 | m_font->setPointSize(fontSize); | ||
262 | fm = QFontMetrics(*m_font); | 221 | fm = QFontMetrics(*m_font); | ||
263 | } | 222 | } | ||
264 | 223 | | |||
265 | p->setFont(*m_font); | 224 | p->setFont(*m_font); | ||
266 | 225 | | |||
267 | p->setPen(Dot2QtConsts::componentData().qtColor(edge()->fontColor())); | 226 | p->setPen(Dot2QtConsts::componentData().qtColor(edge()->fontColor())); | ||
268 | 227 | | |||
269 | qreal x = (m_scaleX * | 228 | qreal x = (m_scaleX * ((dro.integers[0]) + (((-dro.integers[2]) * (fm.width(dro.str))) / 2) - ((fm.width(dro.str)) / 2))) + m_xMargin; | ||
270 | ( | | |||
271 | (dro.integers[0]) | | |||
272 | + (((-dro.integers[2])*(fm.width(dro.str)))/2) | | |||
273 | - ( (fm.width(dro.str))/2 ) | | |||
274 | ) | | |||
275 | ) | | |||
276 | + m_xMargin; | | |||
277 | qreal y = ((m_gh - (dro.integers[1]))*m_scaleY)+ m_yMargin; | 229 | qreal y = ((m_gh - (dro.integers[1])) * m_scaleY) + m_yMargin; | ||
278 | QPointF point(x,y); | 230 | QPointF point(x, y); | ||
279 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawText" << edge()->fontColor() << point; | 231 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawText" << edge()->fontColor() << point; | ||
280 | 232 | | |||
281 | p->drawText(point,str); | 233 | p->drawText(point, str); | ||
282 | 234 | | |||
283 | p->setFont(oldFont); | 235 | p->setFont(oldFont); | ||
284 | p->setPen(oldPen); | 236 | p->setPen(oldPen); | ||
285 | } | 237 | } else if ((dro.renderop == "p") || (dro.renderop == "P")) { | ||
286 | else if (( dro.renderop == "p" ) || (dro.renderop == "P" )) | | |||
287 | { | | |||
288 | QPolygonF polygon(dro.integers[0]); | 238 | QPolygonF polygon(dro.integers[0]); | ||
289 | for (int i = 0; i < dro.integers[0]; i++) | 239 | for (int i = 0; i < dro.integers[0]; i++) { | ||
290 | { | 240 | QPointF point((int(dro.integers[2 * i + 1]) /*%m_wdhcf*/) * m_scaleX + m_xMargin, (int(m_gh - dro.integers[2 * i + 2]) /*%m_hdvcf*/) * m_scaleY + m_yMargin); | ||
291 | QPointF point( | | |||
292 | (int(dro.integers[2*i+1])/*%m_wdhcf*/)*m_scaleX +m_xMargin, | | |||
293 | (int(m_gh-dro.integers[2*i+2])/*%m_hdvcf*/)*m_scaleY + m_yMargin | | |||
294 | ); | | |||
295 | polygon[i] = point; | 241 | polygon[i] = point; | ||
296 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << point; | 242 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << point; | ||
297 | allPoints.append(point); | 243 | allPoints.append(point); | ||
298 | } | 244 | } | ||
299 | if (dro.renderop == "P" ) | 245 | if (dro.renderop == "P") { | ||
300 | { | | |||
301 | p->setBrush(lineColor); | 246 | p->setBrush(lineColor); | ||
302 | p->drawPolygon(polygon); | 247 | p->drawPolygon(polygon); | ||
303 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPolygon" << edge()->color(0) << polygon; | 248 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPolygon" << edge()->color(0) << polygon; | ||
304 | p->setBrush(oldBrush); | 249 | p->setBrush(oldBrush); | ||
305 | } | 250 | } else { | ||
306 | else | | |||
307 | { | | |||
308 | p->setBrush(Dot2QtConsts::componentData().qtColor("white")); | 251 | p->setBrush(Dot2QtConsts::componentData().qtColor("white")); | ||
309 | } | 252 | } | ||
310 | QPen pen(lineColor); | 253 | QPen pen(lineColor); | ||
311 | if (edge()->style() == "bold") | 254 | if (edge()->style() == "bold") { | ||
312 | { | | |||
313 | pen.setStyle(Qt::SolidLine); | 255 | pen.setStyle(Qt::SolidLine); | ||
314 | pen.setWidth((int)(2 * widthScaleFactor)); | 256 | pen.setWidth((int)(2 * widthScaleFactor)); | ||
315 | } | 257 | } else { | ||
316 | else | | |||
317 | { | | |||
318 | pen.setWidth((int)(1 * widthScaleFactor)); | 258 | pen.setWidth((int)(1 * widthScaleFactor)); | ||
319 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | 259 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | ||
320 | } | 260 | } | ||
321 | p->setPen(pen); | 261 | p->setPen(pen); | ||
322 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPolyline" << edge()->color(0) << polygon; | 262 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPolyline" << edge()->color(0) << polygon; | ||
323 | polygon << polygon[0]; | 263 | polygon << polygon[0]; | ||
324 | p->drawPolyline(polygon); | 264 | p->drawPolyline(polygon); | ||
325 | p->setPen(oldPen); | 265 | p->setPen(oldPen); | ||
326 | p->setBrush(oldBrush); | 266 | p->setBrush(oldBrush); | ||
327 | } | 267 | } else if ((dro.renderop == "e") || (dro.renderop == "E")) { | ||
328 | else if (( dro.renderop == "e" ) || (dro.renderop == "E" )) | | |||
329 | { | | |||
330 | qreal w = m_scaleX * dro.integers[2] * 2; | 268 | qreal w = m_scaleX * dro.integers[2] * 2; | ||
331 | qreal h = m_scaleY * dro.integers[3] * 2; | 269 | qreal h = m_scaleY * dro.integers[3] * 2; | ||
332 | qreal x = (m_xMargin + (dro.integers[0]/*%m_wdhcf*/)*m_scaleX) - w/2; | 270 | qreal x = (m_xMargin + (dro.integers[0] /*%m_wdhcf*/) * m_scaleX) - w / 2; | ||
333 | qreal y = ((m_gh - dro.integers[1]/*%m_hdvcf*/)*m_scaleY + m_yMargin) - h/2; | 271 | qreal y = ((m_gh - dro.integers[1] /*%m_hdvcf*/) * m_scaleY + m_yMargin) - h / 2; | ||
334 | if (dro.renderop == "E" ) | 272 | if (dro.renderop == "E") { | ||
335 | { | | |||
336 | p->setBrush(lineColor); | 273 | p->setBrush(lineColor); | ||
337 | } | 274 | } else { | ||
338 | else | | |||
339 | { | | |||
340 | p->setBrush(Dot2QtConsts::componentData().qtColor("white")); | 275 | p->setBrush(Dot2QtConsts::componentData().qtColor("white")); | ||
341 | } | 276 | } | ||
342 | QPen pen(lineColor); | 277 | QPen pen(lineColor); | ||
343 | if (edge()->style() == "bold") | 278 | if (edge()->style() == "bold") { | ||
344 | { | | |||
345 | pen.setStyle(Qt::SolidLine); | 279 | pen.setStyle(Qt::SolidLine); | ||
346 | pen.setWidth(int(2 * widthScaleFactor)); | 280 | pen.setWidth(int(2 * widthScaleFactor)); | ||
347 | } | 281 | } else { | ||
348 | else | | |||
349 | { | | |||
350 | pen.setWidth(int(1 * widthScaleFactor)); | 282 | pen.setWidth(int(1 * widthScaleFactor)); | ||
351 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | 283 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | ||
352 | } | 284 | } | ||
353 | p->setPen(pen); | 285 | p->setPen(pen); | ||
354 | QRectF rect(x,y,w,h); | 286 | QRectF rect(x, y, w, h); | ||
355 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawEllipse" << edge()->color(0) << rect; | 287 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawEllipse" << edge()->color(0) << rect; | ||
356 | p->drawEllipse(rect); | 288 | p->drawEllipse(rect); | ||
357 | p->setPen(oldPen); | 289 | p->setPen(oldPen); | ||
358 | p->setBrush(oldBrush); | 290 | p->setBrush(oldBrush); | ||
359 | } | 291 | } else if (dro.renderop == "B") { | ||
360 | else if ( dro.renderop == "B" ) | | |||
361 | { | | |||
362 | uint lineWidth = 1; | 292 | uint lineWidth = 1; | ||
363 | QPen pen; | 293 | QPen pen; | ||
364 | if (edge()->style() == "bold") | 294 | if (edge()->style() == "bold") { | ||
365 | { | | |||
366 | pen.setStyle(Qt::SolidLine); | 295 | pen.setStyle(Qt::SolidLine); | ||
367 | pen.setWidth(int(2 * widthScaleFactor)); | 296 | pen.setWidth(int(2 * widthScaleFactor)); | ||
368 | } | 297 | } else if (edge()->style() != "filled") { | ||
369 | else if (edge()->style() != "filled") | | |||
370 | { | | |||
371 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | 298 | pen.setStyle(Dot2QtConsts::componentData().qtPenStyle(edge()->style())); | ||
372 | } | 299 | } | ||
373 | if (edge()->style().left(12) == "setlinewidth") | 300 | if (edge()->style().left(12) == "setlinewidth") { | ||
374 | { | | |||
375 | bool ok; | 301 | bool ok; | ||
376 | lineWidth = edge()->style().mid(12, edge()->style().length()-1-12).toInt(&ok); | 302 | lineWidth = edge()->style().mid(12, edge()->style().length() - 1 - 12).toInt(&ok); | ||
377 | pen.setWidth(int(lineWidth * widthScaleFactor)); | 303 | pen.setWidth(int(lineWidth * widthScaleFactor)); | ||
378 | } | 304 | } | ||
379 | if (edge()->attributes().contains("penwidth")) | 305 | if (edge()->attributes().contains("penwidth")) { | ||
380 | { | | |||
381 | bool ok; | 306 | bool ok; | ||
382 | lineWidth = edge()->attributes()["penwidth"].toInt(&ok); | 307 | lineWidth = edge()->attributes()["penwidth"].toInt(&ok); | ||
383 | pen.setWidth(int(lineWidth * widthScaleFactor)); | 308 | pen.setWidth(int(lineWidth * widthScaleFactor)); | ||
384 | } | 309 | } | ||
385 | if (edge()->attributes().contains("color")) | 310 | if (edge()->attributes().contains("color")) { | ||
386 | { | | |||
387 | qCDebug(KGRAPHVIEWERLIB_LOG) << "set edge color to " << QColor(edge()->attributes()["color"]).name(); | 311 | qCDebug(KGRAPHVIEWERLIB_LOG) << "set edge color to " << QColor(edge()->attributes()["color"]).name(); | ||
388 | lineColor = QColor(edge()->attributes()["color"]); | 312 | lineColor = QColor(edge()->attributes()["color"]); | ||
389 | } | 313 | } | ||
390 | for (int splineNum = 0; splineNum < edge()->colors().count() || (splineNum==0 && edge()->colors().count()==0); splineNum++) | 314 | for (int splineNum = 0; splineNum < edge()->colors().count() || (splineNum == 0 && edge()->colors().count() == 0); splineNum++) { | ||
391 | { | | |||
392 | if (splineNum != 0) | 315 | if (splineNum != 0) | ||
393 | lineColor = Dot2QtConsts::componentData().qtColor(edge()->color(splineNum)); | 316 | lineColor = Dot2QtConsts::componentData().qtColor(edge()->color(splineNum)); | ||
394 | pen.setColor(lineColor); | 317 | pen.setColor(lineColor); | ||
395 | // p->setBrush(Dot2QtConsts::componentData().qtColor(edge()->color(0))); | 318 | // p->setBrush(Dot2QtConsts::componentData().qtColor(edge()->color(0))); | ||
396 | p->setBrush(Qt::NoBrush); | 319 | p->setBrush(Qt::NoBrush); | ||
397 | p->setPen(pen); | 320 | p->setPen(pen); | ||
398 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPath" << edge()->color(splineNum) << points.first() << points.last(); | 321 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "drawPath" << edge()->color(splineNum) << points.first() << points.last(); | ||
399 | p->drawPath(pathForSpline(splineNum, dro)); | 322 | p->drawPath(pathForSpline(splineNum, dro)); | ||
400 | p->setPen(oldPen); | 323 | p->setPen(oldPen); | ||
401 | p->setBrush(oldBrush); | 324 | p->setBrush(oldBrush); | ||
402 | } | 325 | } | ||
403 | } | 326 | } | ||
404 | } | 327 | } | ||
405 | if (edge()->isSelected()) | 328 | if (edge()->isSelected()) { | ||
406 | { | | |||
407 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "draw square"; | 329 | // qCDebug(KGRAPHVIEWERLIB_LOG) << "draw square"; | ||
408 | // p->drawRect(m_boundingRect); | 330 | // p->drawRect(m_boundingRect); | ||
409 | qreal maxDist = 0; | 331 | qreal maxDist = 0; | ||
410 | QPair<QPointF,QPointF> pointsPair; | 332 | QPair<QPointF, QPointF> pointsPair; | ||
411 | foreach(const QPointF& point1, allPoints) | 333 | foreach (const QPointF &point1, allPoints) { | ||
412 | { | 334 | foreach (const QPointF &point2, allPoints) { | ||
413 | foreach(const QPointF& point2, allPoints) | 335 | if (distance(point1, point2) > maxDist) { | ||
414 | { | | |||
415 | if (distance(point1, point2) > maxDist) | | |||
416 | { | | |||
417 | maxDist = distance(point1, point2); | 336 | maxDist = distance(point1, point2); | ||
418 | pointsPair = qMakePair(point1, point2); | 337 | pointsPair = qMakePair(point1, point2); | ||
419 | } | 338 | } | ||
420 | } | 339 | } | ||
421 | } | 340 | } | ||
422 | if (maxDist>0) | 341 | if (maxDist > 0) { | ||
423 | { | | |||
424 | // p->setBrush(Dot2QtConsts::componentData().qtColor(edge()->color(0))); | 342 | // p->setBrush(Dot2QtConsts::componentData().qtColor(edge()->color(0))); | ||
425 | p->setBrush(Qt::black); | 343 | p->setBrush(Qt::black); | ||
426 | p->setPen(Qt::black); | 344 | p->setPen(Qt::black); | ||
427 | p->drawRect(QRectF(pointsPair.first-QPointF(3,3),QSizeF(6,6))); | 345 | p->drawRect(QRectF(pointsPair.first - QPointF(3, 3), QSizeF(6, 6))); | ||
428 | p->drawRect(QRectF(pointsPair.second-QPointF(3,3),QSizeF(6,6))); | 346 | p->drawRect(QRectF(pointsPair.second - QPointF(3, 3), QSizeF(6, 6))); | ||
429 | p->setBrush(oldBrush); | 347 | p->setBrush(oldBrush); | ||
430 | p->setPen(oldPen); | 348 | p->setPen(oldPen); | ||
431 | } | 349 | } | ||
432 | } | 350 | } | ||
433 | } | 351 | } | ||
434 | 352 | | |||
435 | void CanvasEdge::modelChanged() | 353 | void CanvasEdge::modelChanged() | ||
436 | { | 354 | { | ||
437 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id(); | 355 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id(); | ||
438 | prepareGeometryChange(); | 356 | prepareGeometryChange(); | ||
439 | computeBoundingRect(); | 357 | computeBoundingRect(); | ||
440 | } | 358 | } | ||
441 | 359 | | |||
442 | void CanvasEdge::computeBoundingRect() | 360 | void CanvasEdge::computeBoundingRect() | ||
443 | { | 361 | { | ||
444 | // qCDebug(KGRAPHVIEWERLIB_LOG); | 362 | // qCDebug(KGRAPHVIEWERLIB_LOG); | ||
445 | //invalidate bounding region cache | 363 | // invalidate bounding region cache | ||
446 | m_shape = QPainterPath(); | 364 | m_shape = QPainterPath(); | ||
447 | if (edge()->renderOperations().isEmpty()) | 365 | if (edge()->renderOperations().isEmpty()) { | ||
448 | { | 366 | if ((edge()->fromNode()->canvasElement() == nullptr) || (edge()->toNode()->canvasElement() == nullptr) || edge()->style() == "invis") { | ||
449 | if ((edge()->fromNode()->canvasElement() == nullptr) | | |||
450 | || (edge()->toNode()->canvasElement() == nullptr) | | |||
451 | || edge()->style()=="invis") | | |||
452 | { | | |||
453 | m_boundingRect = QRectF(); | 367 | m_boundingRect = QRectF(); | ||
454 | } | 368 | } else { | ||
455 | else | 369 | QRectF br(edge()->fromNode()->canvasElement()->boundingRect().center() + edge()->fromNode()->canvasElement()->pos(), edge()->toNode()->canvasElement()->boundingRect().center() + edge()->toNode()->canvasElement()->pos()); | ||
456 | { | | |||
457 | QRectF br( | | |||
458 | edge()->fromNode()->canvasElement()->boundingRect().center()+edge()->fromNode()->canvasElement()->pos(), | | |||
459 | edge()->toNode()->canvasElement()->boundingRect().center()+edge()->toNode()->canvasElement()->pos()); | | |||
460 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() <<br; | 370 | // qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() <<br; | ||
461 | m_boundingRect = br; | 371 | m_boundingRect = br; | ||
462 | } | 372 | } | ||
463 | } | 373 | } else { | ||
464 | else | | |||
465 | { | | |||
466 | QPolygonF points; | 374 | QPolygonF points; | ||
467 | foreach (const DotRenderOp& dro, edge()->renderOperations()) | 375 | foreach (const DotRenderOp &dro, edge()->renderOperations()) { | ||
468 | { | | |||
469 | // qCDebug(KGRAPHVIEWERLIB_LOG) << dro.renderop << ", "; | 376 | // qCDebug(KGRAPHVIEWERLIB_LOG) << dro.renderop << ", "; | ||
470 | if ( (dro.renderop != "B") && (dro.renderop != "p") && (dro.renderop != "P") ) continue; | 377 | if ((dro.renderop != "B") && (dro.renderop != "p") && (dro.renderop != "P")) | ||
378 | continue; | ||||
471 | uint previousSize = points.size(); | 379 | uint previousSize = points.size(); | ||
472 | points.resize(previousSize+dro.integers[0]); | 380 | points.resize(previousSize + dro.integers[0]); | ||
473 | for (int i = 0; i < dro.integers[0]; i++) | 381 | for (int i = 0; i < dro.integers[0]; i++) { | ||
474 | { | 382 | QPointF p(((dro.integers[2 * i + 1] /*%m_wdhcf*/) * m_scaleX) + m_xMargin, ((m_gh - dro.integers[2 * i + 2] /*%m_hdvcf*/) * m_scaleY) + m_yMargin); | ||
475 | QPointF p( | | |||
476 | ((dro.integers[2*i+1]/*%m_wdhcf*/)*m_scaleX) +m_xMargin, | | |||
477 | ((m_gh-dro.integers[2*i+2]/*%m_hdvcf*/)*m_scaleY) + m_yMargin | | |||
478 | ); | | |||
479 | points[previousSize+i] = p; | 383 | points[previousSize + i] = p; | ||
480 | } | 384 | } | ||
481 | } | 385 | } | ||
482 | // qCDebug(KGRAPHVIEWERLIB_LOG) << points.size() << "points"; | 386 | // qCDebug(KGRAPHVIEWERLIB_LOG) << points.size() << "points"; | ||
483 | if (points.size() == 0) return; | 387 | if (points.size() == 0) | ||
388 | return; | ||||
484 | 389 | | |||
485 | int len = points.count(); | 390 | int len = points.count(); | ||
486 | QPolygonF a = points, b = points; | 391 | QPolygonF a = points, b = points; | ||
487 | a.translate(-1, -1); | 392 | a.translate(-1, -1); | ||
488 | b.translate(1, 1); | 393 | b.translate(1, 1); | ||
489 | a.resize(2*len); | 394 | a.resize(2 * len); | ||
490 | for (int i=0;i<len;i++) | 395 | for (int i = 0; i < len; i++) { | ||
491 | { | | |||
492 | a[len+i] = b[i]; | 396 | a[len + i] = b[i]; | ||
493 | } | 397 | } | ||
494 | // qCDebug(KGRAPHVIEWERLIB_LOG) << a.size() << "points"; | 398 | // qCDebug(KGRAPHVIEWERLIB_LOG) << a.size() << "points"; | ||
495 | 399 | | |||
496 | m_boundingRect = a.boundingRect(); | 400 | m_boundingRect = a.boundingRect(); | ||
497 | } | 401 | } | ||
498 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "New bounding rect is:" << m_boundingRect; | 402 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->fromNode()->id() << "->" << edge()->toNode()->id() << "New bounding rect is:" << m_boundingRect; | ||
499 | } | 403 | } | ||
500 | 404 | | |||
501 | void CanvasEdge::mousePressEvent(QGraphicsSceneMouseEvent * event) | 405 | void CanvasEdge::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
502 | { | 406 | { | ||
503 | qCDebug(KGRAPHVIEWERLIB_LOG) << event; | 407 | qCDebug(KGRAPHVIEWERLIB_LOG) << event; | ||
504 | if (m_view->isReadOnly()) | 408 | if (m_view->isReadOnly()) { | ||
505 | { | | |||
506 | return; | 409 | return; | ||
507 | } | 410 | } | ||
508 | if (event->button() == Qt::LeftButton) | 411 | if (event->button() == Qt::LeftButton) { | ||
509 | { | | |||
510 | edge()->setSelected(!edge()->isSelected()); | 412 | edge()->setSelected(!edge()->isSelected()); | ||
511 | if (edge()->isSelected()) | 413 | if (edge()->isSelected()) { | ||
512 | { | | |||
513 | emit(selected(this,event->modifiers())); | 414 | emit(selected(this, event->modifiers())); | ||
514 | } | 415 | } | ||
515 | update(); | 416 | update(); | ||
516 | } | 417 | } else if (event->button() == Qt::RightButton) { | ||
517 | else if (event->button() == Qt::RightButton) | 418 | if (!edge()->isSelected()) { | ||
518 | { | | |||
519 | if (!edge()->isSelected()) | | |||
520 | { | | |||
521 | edge()->setSelected(true); | 419 | edge()->setSelected(true); | ||
522 | emit(selected(this,event->modifiers())); | 420 | emit(selected(this, event->modifiers())); | ||
523 | update(); | 421 | update(); | ||
524 | } | 422 | } | ||
525 | qCDebug(KGRAPHVIEWERLIB_LOG) << "emiting edgeContextMenuEvent("<<m_edge->id()<<","<<event->screenPos()<<")"; | 423 | qCDebug(KGRAPHVIEWERLIB_LOG) << "emiting edgeContextMenuEvent(" << m_edge->id() << "," << event->screenPos() << ")"; | ||
526 | emit(edgeContextMenuEvent(m_edge->id(), event->screenPos() )); | 424 | emit(edgeContextMenuEvent(m_edge->id(), event->screenPos())); | ||
527 | // opens the selected edge contextual menu and if necessary select the edge | 425 | // opens the selected edge contextual menu and if necessary select the edge | ||
528 | /* qCDebug(KGRAPHVIEWERLIB_LOG) << "opens the contextual menu"; | 426 | /* qCDebug(KGRAPHVIEWERLIB_LOG) << "opens the contextual menu"; | ||
529 | m_popup->exec(event->screenPos());*/ | 427 | m_popup->exec(event->screenPos());*/ | ||
530 | } | 428 | } | ||
531 | } | 429 | } | ||
532 | 430 | | |||
533 | qreal CanvasEdge::distance(const QPointF& point1, const QPointF& point2) | 431 | qreal CanvasEdge::distance(const QPointF &point1, const QPointF &point2) | ||
534 | { | 432 | { | ||
535 | return sqrt(pow(point1.x()-point2.x(),2)+pow(point1.y()-point2.y(),2)); | 433 | return sqrt(pow(point1.x() - point2.x(), 2) + pow(point1.y() - point2.y(), 2)); | ||
536 | } | 434 | } | ||
537 | 435 | | |||
538 | void CanvasEdge::slotRemoveEdge() | 436 | void CanvasEdge::slotRemoveEdge() | ||
539 | { | 437 | { | ||
540 | m_view->removeSelectedElements(); | 438 | m_view->removeSelectedElements(); | ||
541 | } | 439 | } | ||
542 | 440 | | |||
543 | void CanvasEdge::hoverEnterEvent( QGraphicsSceneHoverEvent * event ) | 441 | void CanvasEdge::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | ||
544 | { | 442 | { | ||
545 | Q_UNUSED(event) | 443 | Q_UNUSED(event) | ||
546 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->id(); | 444 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->id(); | ||
547 | emit hoverEnter(this); | 445 | emit hoverEnter(this); | ||
548 | } | 446 | } | ||
549 | 447 | | |||
550 | void CanvasEdge::hoverLeaveEvent( QGraphicsSceneHoverEvent * event ) | 448 | void CanvasEdge::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | ||
551 | { | 449 | { | ||
552 | Q_UNUSED(event) | 450 | Q_UNUSED(event) | ||
553 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->id(); | 451 | qCDebug(KGRAPHVIEWERLIB_LOG) << edge()->id(); | ||
554 | emit hoverLeave(this); | 452 | emit hoverLeave(this); | ||
555 | } | 453 | } | ||
556 | 454 | | |||
557 | } | 455 | } |