18 #include <QGraphicsSceneMouseEvent>
20 #include <QStyleOption>
27 , m_pos(QPointF(0, 0))
28 , m_rectangle(QRectF(0, 0, 0, 0))
32 setFlag(QGraphicsItem::ItemIsMovable);
39 painter->setClipRect(
sceneAdapter()->viewportRectangle());
40 painter->setPen(
m_pen);
75 prepareGeometryChange();
The interface of any QGraphicsViewItem on GraphicsScene to the Sceneadapter.
QPointF scenePos(QPointF pixel_pos) const
modify the rectangle for display according to the scene adapter
ModelView::SceneAdapterInterface * sceneAdapter() const
Get the conversion axes.
QRectF displayRect(const QRectF &real_rect) const
modify the rectangle for display according to the scene adapter
Manages the whole appearance of a layer on the graphicsscene.
void segmentViewMoved(SegmentElementView *segment_view)
The move logic for the segments.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
The overriden paint method.
QPainterPath shape() const override
The shape.
void setRectangle(QRectF rectangle)
Set the draw rectangle.
void setPen(QPen pen)
Set the pen.
void setBrush(QBrush brush)
Set the brush.
LayerElementController * p_controller
QRectF boundingRect() const override
The bounding rectangle of the handle.
QPointF getLastPos() const
Get the last position of the item.
SegmentElementView()
The constructor.
void setLayerElementController(LayerElementController *controller)
Set the controller to report back the move.
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
On move save the new position and notify the controller.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.