Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesignerItemLine.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | 164 | { | |||
---|---|---|---|---|---|
165 | QGraphicsLineItem::mouseReleaseEvent(event); | 165 | QGraphicsLineItem::mouseReleaseEvent(event); | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | void KReportDesignerItemLine::mouseMoveEvent(QGraphicsSceneMouseEvent * event) | 168 | void KReportDesignerItemLine::mouseMoveEvent(QGraphicsSceneMouseEvent * event) | ||
169 | { | 169 | { | ||
170 | int x; | 170 | int x; | ||
171 | int y; | 171 | int y; | ||
172 | 172 | | |||
173 | QPointF p = dynamic_cast<KReportDesignerSectionScene*>(scene())->gridPoint(event->scenePos()); | 173 | KReportDesignerSectionScene *section = dynamic_cast<KReportDesignerSectionScene*>(scene()); | ||
174 | if (!section) { | ||||
175 | return; | ||||
176 | } | ||||
177 | | ||||
178 | QPointF p = section->gridPoint(event->scenePos()); | ||||
staniek: Can we avoid the underscore? | |||||
staniek: `qobject_cast` | |||||
174 | //kreportDebug() << p; | 179 | //kreportDebug() << p; | ||
175 | x = p.x(); | 180 | x = p.x(); | ||
176 | y = p.y(); | 181 | y = p.y(); | ||
177 | 182 | | |||
178 | if (x < 0) x = 0; | 183 | if (x < 0) x = 0; | ||
179 | if (y < 0) y = 0; | 184 | if (y < 0) y = 0; | ||
180 | if (x > scene()->width()) x = scene()->width(); | 185 | if (x > scene()->width()) x = scene()->width(); | ||
181 | if (y > scene()->height()) y = scene()->height(); | 186 | if (y > scene()->height()) y = scene()->height(); | ||
182 | 187 | | |||
183 | switch (m_grabAction) { | 188 | switch (m_grabAction) { | ||
184 | case 1: | 189 | case 1: | ||
185 | m_start->setValue(positionFromScene(QPointF(x,y))); | 190 | m_start->setValue(positionFromScene(QPointF(x,y))); | ||
186 | break; | 191 | break; | ||
187 | case 2: | 192 | case 2: | ||
188 | m_end->setValue(positionFromScene(QPointF(x,y))); | 193 | m_end->setValue(positionFromScene(QPointF(x,y))); | ||
189 | break; | 194 | break; | ||
190 | default: | 195 | default: | ||
191 | QPointF d = mapToItem(this, dynamic_cast<KReportDesignerSectionScene*>(scene())->gridPoint(event->scenePos())) - mapToItem(this, dynamic_cast<KReportDesignerSectionScene*>(scene())->gridPoint(event->lastScenePos())); | 196 | QPointF d = mapToItem(this, section->gridPoint(event->scenePos())) - mapToItem(this, section->gridPoint(event->lastScenePos())); | ||
192 | 197 | | |||
193 | if (((line().p1() + d).x() >= 0) && | 198 | if (((line().p1() + d).x() >= 0) && | ||
194 | ((line().p2() + d).x() >= 0) && | 199 | ((line().p2() + d).x() >= 0) && | ||
195 | ((line().p1() + d).y() >= 0) && | 200 | ((line().p1() + d).y() >= 0) && | ||
196 | ((line().p2() + d).y() >= 0) && | 201 | ((line().p2() + d).y() >= 0) && | ||
197 | ((line().p1() + d).x() <= scene()->width()) && | 202 | ((line().p1() + d).x() <= scene()->width()) && | ||
198 | ((line().p2() + d).x() <= scene()->width()) && | 203 | ((line().p2() + d).x() <= scene()->width()) && | ||
199 | ((line().p1() + d).y() <= scene()->height()) && | 204 | ((line().p1() + d).y() <= scene()->height()) && | ||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
Can we avoid the underscore?