16 #include "Base/Util/Assert.h"
20 const double bbox_margins = 5;
25 , m_activeHandleElement(nullptr)
27 setFlag(QGraphicsItem::ItemIsSelectable);
28 setFlag(QGraphicsItem::ItemIsMovable);
29 setFlag(QGraphicsItem::ItemSendsGeometryChanges);
30 setAcceptHoverEvents(
true);
37 if (going_to_resize) {
38 setFlag(QGraphicsItem::ItemIsMovable,
false);
45 setFlag(QGraphicsItem::ItemIsMovable,
true);
52 const QVariant& value)
54 if (change == QGraphicsItem::ItemSelectedChange) {
56 it.value()->setVisible(!this->isSelected());
64 IShape2DView::mouseReleaseEvent(event);
69 prepareGeometryChange();
82 QMarginsF(bbox_margins, bbox_margins, bbox_margins, bbox_margins));
84 for (QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*>::iterator it =
87 it.value()->updateHandleElementPosition(
m_mask_rect);
105 QList<SizeHandleElement::EHandleLocation> points;
115 el->setVisible(
false);
Defines RectangleBaseView class.
Main interface class for views representing MaskItems, Projections on graphics scene.
virtual SessionItem * parameterizedItem() const =0
void create_size_handle_elements()
virtual qreal right() const =0
virtual QRectF mask_rectangle()=0
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.
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
void onSizeHandleElementRequest(bool going_to_resize)
triggered by SizeHandleElement
int type() const override
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
Track if item selected/deselected and show/hide size handles.
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
virtual void update_bounding_rect()
updates view's bounding rectangle using item properties
void update_view() override
update visual appearance of view (triggered by ISceneAdaptor)
QPointF m_resize_opposite_origin
virtual qreal left() const =0
RectangleBaseView(SessionItem *item)
virtual qreal bottom() const =0
Base class for a GUI data item.
Size handle on top of RectangleView represented as small circle or small rectangle....
void resize_request(bool going_to_resize)
EHandleLocation getOppositeHandleLocation() const