Feature added: Rotation point center property for dynamic text fields

Now a new checkbox in the dynamictextfieldeditor is available (by default set to false for legacy) to make it possible to turn dynamic text fields around its own center.
This resolves an undesirable behaviour that occurs when the text alignment is retained

Including translation to english and german
This commit is contained in:
Levi Jetzer
2026-08-08 11:10:36 +02:00
parent 5c39518921
commit 615e40dee2
7 changed files with 72 additions and 9 deletions
@@ -51,7 +51,7 @@ class DynamicElementTextItem : public DiagramTextItem
Q_PROPERTY(bool frame READ frame WRITE setFrame NOTIFY frameChanged)
Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth NOTIFY textWidthChanged)
Q_PROPERTY(bool keepVisualRotation READ keepVisualRotation WRITE setKeepVisualRotation NOTIFY keepVisualRotationChanged)
Q_PROPERTY(bool rotationPointCenter READ rotationPointCenter WRITE setRotationPointCenter NOTIFY rotationPointCenterChanged)
public:
enum TextFrom {
@@ -72,6 +72,7 @@ class DynamicElementTextItem : public DiagramTextItem
void plainTextChanged();
void textWidthChanged(qreal width);
void keepVisualRotationChanged(bool keep);
void rotationPointCenterChanged(bool center);
public:
DynamicElementTextItem(Element *parent_element);
@@ -113,6 +114,9 @@ class DynamicElementTextItem : public DiagramTextItem
void setKeepVisualRotation(bool set);
bool keepVisualRotation() const;
void setRotationPointCenter(bool set);
bool rotationPointCenter() const;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
@@ -172,6 +176,7 @@ class DynamicElementTextItem : public DiagramTextItem
qreal m_text_width = -1;
QPointF m_initial_position;
bool m_keep_visual_rotation = true;
bool m_rotation_point_center = false;
qreal m_visual_rotation_ref = 0;
bool m_move_parent = true;
};