48 return(dynamic_cast<QGraphicsItem *>(
this));
69 QList<QPointF>
CustomElementPart::mapPoints(
const QRectF &initial_selection_rect,
const QRectF &new_selection_rect,
const QList<QPointF> &points) {
70 QList<QPointF> new_points;
71 if (!points.count())
return(new_points);
74 qreal sx = new_selection_rect.width() / initial_selection_rect.width();
75 qreal sy = new_selection_rect.height() / initial_selection_rect.height();
77 QPointF initial_top_left = initial_selection_rect.topLeft();
78 qreal new_top_left_x = new_selection_rect.x();
79 qreal new_top_left_y = new_selection_rect.y();
81 foreach (QPointF point, points) {
82 QPointF point_offset = point - initial_top_left;
83 new_points << QPointF(
84 new_top_left_x + (point_offset.rx() * sx),
85 new_top_left_y + (point_offset.y() * sy)
virtual QUndoStack & undoStack() const
snap the point used to define the new bounding rectangle to the grid
virtual QETElementEditor * elementEditor() const
virtual QET::ScalingMethod preferredScalingMethod() const
QList< QPointF > mapPoints(const QRectF &, const QRectF &, const QList< QPointF > &)
virtual QGraphicsItem * toItem()
QETElementEditor * element_editor
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive. ...
virtual void updateCurrentPartEditor() const
virtual ElementScene * elementScene() const