Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesignerItemRectBase.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
65 | return QRectF(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size())); | 65 | return QRectF(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size())); | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | QRectF KReportDesignerItemRectBase::pointRect() const | 68 | QRectF KReportDesignerItemRectBase::pointRect() const | ||
69 | { | 69 | { | ||
70 | return QRectF(item()->position(), item()->size()); | 70 | return QRectF(item()->position(), item()->size()); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | void KReportDesignerItemRectBase::setSceneRect(const QPointF& topLeft, const QSizeF& size, UpdatePropertyFlag update) | 73 | void KReportDesignerItemRectBase::setSceneRect(const QPointF& topLeft, const QSizeF& size, SceneRectFlag update) | ||
74 | { | 74 | { | ||
75 | setSceneRect(QRectF(topLeft, size), update); | 75 | setSceneRect(QRectF(topLeft, size), update); | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | void KReportDesignerItemRectBase::setSceneRect(const QRectF& rect, UpdatePropertyFlag update) | 78 | void KReportDesignerItemRectBase::setSceneRect(const QRectF& rect, SceneRectFlag update) | ||
79 | { | 79 | { | ||
80 | QGraphicsRectItem::setPos(rect.x(), rect.y()); | 80 | QGraphicsRectItem::setPos(rect.x(), rect.y()); | ||
81 | setRect(0, 0, rect.width(), rect.height()); | 81 | setRect(0, 0, rect.width(), rect.height()); | ||
82 | if (update == UpdateProperty) { | 82 | if (update == SceneRectFlag::UpdateProperty) { | ||
83 | item()->setPosition(KReportItemBase::positionFromScene(QPointF(rect.x(), rect.y()))); | 83 | item()->setPosition(KReportItemBase::positionFromScene(QPointF(rect.x(), rect.y()))); | ||
84 | item()->setSize(KReportItemBase::sizeFromScene(QSizeF(rect.width(), rect.height()))); | 84 | item()->setSize(KReportItemBase::sizeFromScene(QSizeF(rect.width(), rect.height()))); | ||
85 | } | 85 | } | ||
86 | this->update(); | 86 | this->update(); | ||
87 | } | 87 | } | ||
88 | 88 | | |||
89 | void KReportDesignerItemRectBase::mousePressEvent(QGraphicsSceneMouseEvent * event) | 89 | void KReportDesignerItemRectBase::mousePressEvent(QGraphicsSceneMouseEvent * event) | ||
90 | { | 90 | { | ||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Line(s) | 296 | } else if (change == ItemSceneHasChanged && item()) { | |||
302 | else if (newPos.x() > (scene()->width() - rect().width())) | 302 | else if (newPos.x() > (scene()->width() - rect().width())) | ||
303 | newPos.setX(scene()->width() - rect().width()); | 303 | newPos.setX(scene()->width() - rect().width()); | ||
304 | 304 | | |||
305 | if (newPos.y() < 0) | 305 | if (newPos.y() < 0) | ||
306 | newPos.setY(0); | 306 | newPos.setY(0); | ||
307 | else if (newPos.y() > (scene()->height() - rect().height())) | 307 | else if (newPos.y() > (scene()->height() - rect().height())) | ||
308 | newPos.setY(scene()->height() - rect().height()); | 308 | newPos.setY(scene()->height() - rect().height()); | ||
309 | 309 | | |||
310 | setSceneRect(newPos, KReportItemBase::sceneSize(item()->size()), KReportDesignerItemRectBase::DontUpdateProperty); | 310 | setSceneRect(newPos, KReportItemBase::sceneSize(item()->size()), | ||
311 | KReportDesignerItemRectBase::SceneRectFlag::DontUpdateProperty); | ||||
311 | } | 312 | } | ||
312 | } | 313 | } | ||
313 | return QGraphicsItem::itemChange(change, value); | 314 | return QGraphicsItem::itemChange(change, value); | ||
314 | } | 315 | } | ||
315 | 316 | | |||
316 | void KReportDesignerItemRectBase::propertyChanged(const KPropertySet &s, const KProperty &p) | 317 | void KReportDesignerItemRectBase::propertyChanged(const KPropertySet &s, const KProperty &p) | ||
317 | { | 318 | { | ||
318 | Q_UNUSED(s) | 319 | Q_UNUSED(s) | ||
319 | Q_UNUSED(p) | 320 | Q_UNUSED(p) | ||
320 | #if 0 | 321 | #if 0 | ||
321 | if (p.name() == "position") { | 322 | if (p.name() == "position") { | ||
322 | item()->setPosition(item()->unit().convertToPoint(p.value().toPointF())); //TODO dont update property | 323 | item()->setPosition(item()->unit().convertToPoint(p.value().toPointF())); //TODO dont update property | ||
323 | } else if (p.name() == "size") { | 324 | } else if (p.name() == "size") { | ||
324 | item()->setSize(item()->unit().convertToPoint(p.value().toSizeF())); //TODO dont update property | 325 | item()->setSize(item()->unit().convertToPoint(p.value().toSizeF())); //TODO dont update property | ||
325 | } | 326 | } | ||
326 | #endif | 327 | #endif | ||
327 | setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()), DontUpdateProperty); | 328 | setSceneRect(KReportItemBase::scenePosition(item()->position()), | ||
329 | KReportItemBase::sceneSize(item()->size()), SceneRectFlag::DontUpdateProperty); | ||||
328 | } | 330 | } | ||
329 | 331 | | |||
330 | void KReportDesignerItemRectBase::move(const QPointF& /*m*/) | 332 | void KReportDesignerItemRectBase::move(const QPointF& /*m*/) | ||
331 | { | 333 | { | ||
332 | //! @todo | 334 | //! @todo | ||
333 | } | 335 | } | ||
334 | 336 | | |||
335 | QPointF KReportDesignerItemRectBase::properPressPoint(const KReportDesigner &d) const | 337 | QPointF KReportDesignerItemRectBase::properPressPoint(const KReportDesigner &d) const | ||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |