summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2022-04-26 09:22:15 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2022-04-26 13:49:37 +0000
commitdf16d4511e6c3daa17b6fbc1b9ffca510da1f882 (patch)
tree73e4bd34b1d30343dec097cc148ef8a933c51b0a
parentbf760f761af0da2bb3808b0f94f168a9822a1bfa (diff)
downloadqt-creator-df16d4511e6c3daa17b6fbc1b9ffca510da1f882.tar.gz
QmlDesigner: Add new way to load fonts to template
StudioApplication will load the correct font in time. This only works for Qt 6. Task-number: QDS-3286 Change-Id: I2d97ca19bace8e13c7a4df355d1addb7267e117c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> (cherry picked from commit 099f02b5db2b4256b9238c3a27173c458da6f95e)
-rw-r--r--share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/Constants.qml.tpl14
1 files changed, 12 insertions, 2 deletions
diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/Constants.qml.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/Constants.qml.tpl
index 98c1927f2e..6fcae14ea6 100644
--- a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/Constants.qml.tpl
+++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/Constants.qml.tpl
@@ -1,12 +1,15 @@
pragma Singleton
import QtQuick %{QtQuickVersion}
+@if %{IsQt6Project}
+import QtQuick.Studio.Application
+@else
+@endif
QtObject {
readonly property int width: %{ScreenWidth}
readonly property int height: %{ScreenHeight}
- property alias fontDirectory: directoryFontLoader.fontDirectory
- property alias relativeFontDirectory: directoryFontLoader.relativeFontDirectory
+ property string relativeFontDirectory: "fonts"
/* Edit this comment to add your custom font */
readonly property font font: Qt.font({
@@ -20,7 +23,14 @@ QtObject {
readonly property color backgroundColor: "#c2c2c2"
+
+@if %{IsQt6Project}
+ property StudioApplication application: StudioApplication {
+ fontPath: Qt.resolvedUrl("../../content/" + relativeFontDirectory)
+ }
+@else
property DirectoryFontLoader directoryFontLoader: DirectoryFontLoader {
id: directoryFontLoader
}
+@endif
}