| 1 | // Copyright (C) 2017 The Qt Company Ltd. | 
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 3 |  | 
| 4 | #include "qquickimaginetheme_p.h" | 
| 5 |  | 
| 6 | #include <QtQuickTemplates2/private/qquicktheme_p.h> | 
| 7 |  | 
| 8 | #include <qfontdatabase.h> | 
| 9 |  | 
| 10 | QT_BEGIN_NAMESPACE | 
| 11 |  | 
| 12 | void QQuickImagineTheme::initialize(QQuickTheme *theme) | 
| 13 | { | 
| 14 |     const auto defaultFontFamily = QLatin1String("Open Sans" ); | 
| 15 |     if (QFontDatabase::hasFamily(family: defaultFontFamily)) { | 
| 16 |         const QFont systemFont(QStringList{defaultFontFamily}); | 
| 17 |         theme->setFont(scope: QQuickTheme::System, font: systemFont); | 
| 18 |     } | 
| 19 |  | 
| 20 |     const QColor accentColor = QColor::fromRgb(rgb: 0x4fc1e9); | 
| 21 |     const QColor windowTextColor = QColor::fromRgb(rgb: 0x434a54); | 
| 22 |     const QColor disabledWindowTextColor = QColor::fromRgb(rgb: 0xccd1d9); | 
| 23 |  | 
| 24 |     QPalette systemPalette; | 
| 25 |     systemPalette.setColor(acr: QPalette::ButtonText, acolor: Qt::white); | 
| 26 |     systemPalette.setColor(acr: QPalette::BrightText, acolor: Qt::white); | 
| 27 |     systemPalette.setColor(acr: QPalette::Highlight, acolor: accentColor); | 
| 28 |     systemPalette.setColor(acr: QPalette::HighlightedText, acolor: Qt::white); | 
| 29 |     systemPalette.setColor(acr: QPalette::Text, acolor: windowTextColor); | 
| 30 |     systemPalette.setColor(acr: QPalette::ToolTipText, acolor: Qt::white); | 
| 31 |     systemPalette.setColor(acr: QPalette::WindowText, acolor: windowTextColor); | 
| 32 |     systemPalette.setColor(acg: QPalette::Disabled, acr: QPalette::Text, acolor: disabledWindowTextColor); | 
| 33 |     systemPalette.setColor(acg: QPalette::Disabled, acr: QPalette::WindowText, acolor: disabledWindowTextColor); | 
| 34 |     theme->setPalette(scope: QQuickTheme::System, palette: systemPalette); | 
| 35 | } | 
| 36 |  | 
| 37 | QT_END_NAMESPACE | 
| 38 |  |