forked from qt-creator/qt-creator
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 099f02b5db
)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user