19 const double bbox_margins = 5;
24 setFlag(QGraphicsItem::ItemIsSelectable);
25 setFlag(QGraphicsItem::ItemIsMovable);
26 setFlag(QGraphicsItem::ItemSendsGeometryChanges);
27 setAcceptHoverEvents(
true);
34 if (going_to_resize) {
35 setFlag(QGraphicsItem::ItemIsMovable,
false);
42 setFlag(QGraphicsItem::ItemIsMovable,
true);
49 const QVariant& value)
51 if (change == QGraphicsItem::ItemSelectedChange) {
53 it.value()->setVisible(!this->isSelected());
62 IShape2DView::mouseReleaseEvent(event);
67 prepareGeometryChange();
79 QMarginsF(bbox_margins, bbox_margins, bbox_margins, bbox_margins));
81 for (QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*>::iterator it =
84 it.value()->updateHandleElementPosition(
m_mask_rect);
102 QList<SizeHandleElement::EHandleLocation> points;
112 el->setVisible(
false);
Defines the macro ASSERT.
#define ASSERT(condition)
Defines RectangleBaseView class.
void create_size_handle_elements()
virtual qreal right() const =0
virtual QRectF mask_rectangle()=0
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
SizeHandleElement * m_activeHandleElement
virtual qreal top() const =0
QRectF m_mask_rect
mask rectangle in scene coordinates
qreal width() const
returns width of the rectangle
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Track if item selected/deselected and show/hide size handles.
void onSizeHandleElementRequest(bool going_to_resize)
triggered by SizeHandleElement
virtual void update_position()=0
QMap< SizeHandleElement::EHandleLocation, SizeHandleElement * > m_resize_handles
coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates
void update_view()
update visual appearance of view (triggered by ISceneAdaptor)
virtual void update_bounding_rect()
updates view's bounding rectangle using item properties
QPointF m_resize_opposite_origin
virtual qreal left() const =0
virtual qreal bottom() const =0
Size handle on top of RectangleView represented as small circle or small rectangle.
void resize_request(bool going_to_resize)
EHandleLocation getOppositeHandleLocation() const