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
@@ -148,6 +148,7 @@ const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const
root_element.setAttribute("frame", m_frame? "true" : "false");
root_element.setAttribute("text_width", QString::number(m_text_width));
root_element.setAttribute("keep_visual_rotation", m_keep_visual_rotation ? "true" : "false");
root_element.setAttribute("rotation_point_center", m_rotation_point_center ? "true" : "false");
QMetaEnum me = DynamicElementTextItem::textFromMetaEnum();
root_element.setAttribute("text_from", me.valueToKey(m_text_from));
@@ -212,6 +213,7 @@ void PartDynamicTextField::fromXml(const QDomElement &dom_elmt) {
setZValue(dom_elmt.attribute("z", QString::number(zValue())).toDouble());
QGraphicsObject::setRotation(QET::correctAngle(dom_elmt.attribute("rotation", QString::number(0)).toDouble()));
setKeepVisualRotation(dom_elmt.attribute("keep_visual_rotation", "true") == "true"? true : false);
setRotationPointCenter(dom_elmt.attribute("rotation_point_center", "false") == "true"? true : false);
if (dom_elmt.hasAttribute("font")) {
QFont font_;
@@ -492,6 +494,20 @@ bool PartDynamicTextField::keepVisualRotation() const {
return m_keep_visual_rotation;
}
void PartDynamicTextField::setRotationPointCenter(const bool &center)
{
if (center == this->m_rotation_point_center) {
return;
}
m_rotation_point_center = center;
emit rotationPointCenterChanged(center);
}
bool PartDynamicTextField::rotationPointCenter() const {
return m_rotation_point_center;
}
/**
@brief PartDynamicTextField::mouseMoveEvent
@param event