18 #ifndef ELEMENTPRIMITIVEDECORATOR_H 19 #define ELEMENTPRIMITIVEDECORATOR_H 21 #include <QGraphicsObject> 48 enum {
Type = UserType + 2200 };
53 void paint(QPainter *,
const QStyleOptionGraphicsItem *, QWidget * =
nullptr)
override;
55 void setItems(
const QList<QGraphicsItem *> &);
56 void setItems(
const QList<CustomElementPart *> &);
57 QList<CustomElementPart *>
items()
const;
77 QVariant
itemChange(GraphicsItemChange change,
const QVariant &value)
override;
88 void scaleItems(
const QRectF &,
const QRectF &);
QPointF deltaForRoundScaling(const QRectF &, const QRectF &, qreal)
void keyPressEvent(QKeyEvent *) override
void saveOriginalBoundingRect()
QRectF modified_bounding_rect_
new bounding rect, after the user moved or resized items
void addHandler()
ElementPrimitiveDecorator::addHandler Add handlers for this item.
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
QVector< QPointF > getResizingsPoints() const
QPointF snapConstPointToGrid(const QPointF &) const
bool moving_by_keys_
Whether we are currently moving our decorated items using the arrow keys.
~ElementPrimitiveDecorator() override
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
ElementPrimitiveDecorator::handlerMouseReleaseEvent.
QList< CustomElementPart * > items() const
void mouseMoveEvent(QGraphicsSceneMouseEvent *) override
QPointF keys_movement_
Movement applied to our decorated items using the arrow keys.
void actionFinished(ElementEditionCommand *)
QList< QGraphicsItem * > graphicsItems() const
QET::ScalingMethod scalingMethod(QGraphicsSceneMouseEvent *)
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
QPointF mouse_offset_
Offset between the mouse position and the point to be snapped to grid when moving selection...
QList< CustomElementPart * > decorated_items_
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
ElementPrimitiveDecorator::handlerMousePressEvent.
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
ElementPrimitiveDecorator::itemChange.
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
ElementPrimitiveDecorator::handlerMouseMoveEvent.
The ElementEditionCommand class ElementEditionCommand is the base class for all commands classes invo...
QPointF latest_pos_
Latest point involved within the current resizing operation.
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
ElementPrimitiveDecorator::sceneEventFilter.
int current_operation_square_
QRectF effective_bounding_rect_
actual, effective bounding rect – never shrinks
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
void snapPointToGrid(QPointF &) const
void applyMovementToRect(int, const QPointF &, QRectF &)
int grid_step_x_
Grid horizontal step.
void keyReleaseEvent(QKeyEvent *) override
QRectF original_bounding_rect_
original bounding rect
QRectF internalBoundingRect() const
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive. ...
void adjusteHandlerPos()
ElementPrimitiveDecorator::adjusteHandlerPos.
QRectF boundingRect() const override
QPointF first_pos_
First point involved within the current resizing operation.
void removeHandler()
ElementPrimitiveDecorator::removeHandler Remove the handlers of this item.
ElementPrimitiveDecorator(QGraphicsItem *=nullptr)
void mousePressEvent(QGraphicsSceneMouseEvent *) override
int grid_step_y_
Grid horizontal step.
void setItems(const QList< QGraphicsItem *> &)
bool mustSnapToGrid(QGraphicsSceneMouseEvent *)
void translateItems(const QPointF &)
int type() const override
QRectF getSceneBoundingRect(QGraphicsItem *) const
CustomElementPart * singleItem() const
void scaleItems(const QRectF &, const QRectF &)
void adjustEffectiveBoundingRect()
QVector< QetGraphicsHandlerItem * > m_handler_vector