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
@@ -44,6 +44,7 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(bool keepVisualRotation READ keepVisualRotation WRITE setKeepVisualRotation NOTIFY keepVisualRotationChanged)
Q_PROPERTY(bool rotationPointCenter READ rotationPointCenter WRITE setRotationPointCenter NOTIFY rotationPointCenterChanged)
public:
///PROPERTY
@@ -62,6 +63,7 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart
void alignmentChanged(Qt::Alignment alignment);
void fontChanged(QFont font);
void keepVisualRotationChanged(bool keep);
void rotationPointCenterChanged(bool center);
public:
PartDynamicTextField(QETElementEditor *editor, QGraphicsItem *parent = nullptr);
@@ -100,6 +102,8 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart
void setFont(const QFont &font);
void setKeepVisualRotation(const bool &keep);
bool keepVisualRotation() const;
void setRotationPointCenter(const bool &center);
bool rotationPointCenter() const;
void setRotation(qreal angle);
void mirror();
@@ -129,7 +133,8 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart
bool m_frame = false,
m_first_add = true,
m_block_alignment = false,
m_keep_visual_rotation = false;
m_keep_visual_rotation = false,
m_rotation_point_center = false;
qreal m_text_width = -1;
Qt::Alignment m_alignment = Qt::AlignTop|Qt::AlignLeft;
QRectF m_alignment_rect;