pragma Singleton import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 import QtQuick.Controls.Styles 1.4 // NOTE: Since singletons cannot reload during runtime, this file must be built before running // *even in qtDeveloperMode* QtObject { id: root property string currentOS: (Qt.platform.os === "osx") ? "Mac" : "Windows" property bool isSimplifiedChinese: enableSimplifiedChineseFontOverride && (Qt.locale().name === "zh_CN") property string standard: { var properties = { "Windows": isSimplifiedChinese ? "Microsoft YaHei with Fallback" : "Segoe UI", "Mac": ".AppleUISystemFont" }; return itemFromThemes(properties); } // On Windows, the Segoe UI Font family does not have a corresponding Semibold name. // Instead there is a separate font family name called "Segoe UI Semibold" // For Mac, the default Apple UI System Font has a style name of "Semibold" so styleName: "Semibold" will work property string semibold: { var properties = { "Windows": isSimplifiedChinese ? "Microsoft YaHei with Fallback" : "Segoe UI Semibold", "Mac": ".AppleUISystemFont" }; return itemFromThemes(properties); } // TODO 1289838: Add Semilight for Mac // Currently it just defaults to Regular. styleNames for Light,Semilight,Thin,etc do not load property string semilight: { var properties = { "Windows": isSimplifiedChinese ? "Microsoft YaHei Light with Fallback" : "Segoe UI Semilight", "Mac": ".AppleUISystemFont" }; return itemFromThemes(properties); } function itemFromThemes(ThemeList) { return ThemeList[currentOS]; } }