summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-30 11:31:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-05-03 06:42:33 +0000
commitb2ebc64dd9914359fe8acf2bc9960e341e98cf80 (patch)
tree7f536ea5cbdb91671ae2b249f7c8f2e859811ac0
parent6d52d86b999088ec07e58c14197bddda043ef0aa (diff)
uic: Fix font family code generation for pythonv6.1.06.1.0
Amend the code introduced by d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8 to generator correct code for Python. Pick-to: 6.1 dev Change-Id: I71fc9a1830d6bd591d32ce08002572c29f02a27f Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp6
-rw-r--r--src/tools/uic/shared/language.cpp6
-rw-r--r--src/tools/uic/shared/language.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 534a78791d..9471fd22d9 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1624,8 +1624,10 @@ QString WriteInitialization::writeFontProperties(const DomFont *f)
m_output << m_indent << language::stackVariable("QFont", fontName)
<< language::eol;
if (f->hasElementFamily() && !f->elementFamily().isEmpty()) {
- m_output << m_indent << fontName << ".setFamilies(QStringList{"
- << language::qstring(f->elementFamily(), m_dindent) << "})" << language::eol;
+ m_output << m_indent << fontName << ".setFamilies("
+ << language::listStart
+ << language::qstring(f->elementFamily(), m_dindent)
+ << language::listEnd << ')' << language::eol;
}
if (f->hasElementPointSize() && f->elementPointSize() > 0) {
m_output << m_indent << fontName << ".setPointSize(" << f->elementPointSize()
diff --git a/src/tools/uic/shared/language.cpp b/src/tools/uic/shared/language.cpp
index 48f5830760..2f2ae3ebc6 100644
--- a/src/tools/uic/shared/language.cpp
+++ b/src/tools/uic/shared/language.cpp
@@ -43,6 +43,8 @@ void setLanguage(Language l)
switch (_language) {
case Language::Cpp:
derefPointer = QLatin1String("->");
+ listStart = '{';
+ listEnd = '}';
nullPtr = QLatin1String("nullptr");
operatorNew = QLatin1String("new ");
qtQualifier = QLatin1String("Qt::");
@@ -54,6 +56,8 @@ void setLanguage(Language l)
break;
case Language::Python:
derefPointer = QLatin1String(".");
+ listStart = '[';
+ listEnd = ']';
nullPtr = QLatin1String("None");
operatorNew = QLatin1String("");
qtQualifier = QLatin1String("Qt.");
@@ -67,6 +71,8 @@ void setLanguage(Language l)
}
QString derefPointer;
+char listStart;
+char listEnd;
QString nullPtr;
QString operatorNew;
QString qtQualifier;
diff --git a/src/tools/uic/shared/language.h b/src/tools/uic/shared/language.h
index fcc2d5d258..918f25e46a 100644
--- a/src/tools/uic/shared/language.h
+++ b/src/tools/uic/shared/language.h
@@ -48,6 +48,8 @@ ConnectionSyntax connectionSyntax();
void setConnectionSyntax(ConnectionSyntax cs);
extern QString derefPointer;
+extern char listStart;
+extern char listEnd;
extern QString nullPtr;
extern QString operatorNew;
extern QString qtQualifier;