Merge pull request #582 from DieterMayerOSS/pr/font-legacy-format

Write font descriptions in a version-stable format (#553)
This commit is contained in:
Laurent Trinques
2026-07-31 10:30:49 +02:00
committed by GitHub
13 changed files with 178 additions and 27 deletions
@@ -20,6 +20,7 @@
#include "../../QPropertyUndoCommand/qpropertyundocommand.h"
#include "../../qetapp.h"
#include "../elementscene.h"
#include "../../utils/qetutils.h"
#include <QApplication>
#include <QColor>
@@ -142,7 +143,7 @@ const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const
root_element.setAttribute("y", QString::number(y));
root_element.setAttribute("z", QString::number(zValue()));
root_element.setAttribute("rotation", QString::number(QET::correctAngle(rot)));
root_element.setAttribute("font", font().toString());
root_element.setAttribute("font", QETUtils::fontToString(font()));
root_element.setAttribute("uuid", m_uuid.toString());
root_element.setAttribute("frame", m_frame? "true" : "false");
root_element.setAttribute("text_width", QString::number(m_text_width));
@@ -214,7 +215,7 @@ void PartDynamicTextField::fromXml(const QDomElement &dom_elmt) {
if (dom_elmt.hasAttribute("font")) {
QFont font_;
font_.fromString(dom_elmt.attribute("font"));
QETUtils::fontFromString(font_, dom_elmt.attribute("font"));
setFont(font_);
}
else if (dom_elmt.hasAttribute("font_size")) {
+3 -2
View File
@@ -23,6 +23,7 @@
#include "../elementprimitivedecorator.h"
#include "../elementscene.h"
#include "../ui/texteditor.h"
#include "../../utils/qetutils.h"
/**
Constructeur
@@ -125,7 +126,7 @@ void PartText::fromXml(const QDomElement &xml_element) {
}
else if (xml_element.hasAttribute("font")) {
QFont font_;
font_.fromString(xml_element.attribute("font"));
QETUtils::fontFromString(font_, xml_element.attribute("font"));
setFont(font_);
}
@@ -165,7 +166,7 @@ const QDomElement PartText::toXml(QDomDocument &xml_document) const
xml_element.setAttribute("x", QString::number(x));
xml_element.setAttribute("y", QString::number(y));
xml_element.setAttribute("text", toPlainText());
xml_element.setAttribute("font", font().toString());
xml_element.setAttribute("font", QETUtils::fontToString(font()));
xml_element.setAttribute("rotation", QString::number(rot));
xml_element.setAttribute("color", defaultTextColor().name());