Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickimaginetheme.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
7#include <QtQuickTemplates2/private/qquicktheme_p.h>
8
9#include <qfontdatabase.h>
10
12
13void QQuickImagineTheme::initialize(QQuickTheme *theme)
14{
15 const auto defaultFontFamily = QLatin1String("Open Sans");
16 if (QFontDatabase::hasFamily(defaultFontFamily)) {
17 const QFont systemFont(QStringList{defaultFontFamily});
18 theme->setFont(QQuickTheme::System, systemFont);
19 }
20
21 const QColor accentColor = QColor::fromRgb(0x4fc1e9);
22 const QColor windowTextColor = QColor::fromRgb(0x434a54);
23 const QColor disabledWindowTextColor = QColor::fromRgb(0xccd1d9);
24
25 QPalette systemPalette;
26 systemPalette.setColor(QPalette::ButtonText, Qt::white);
27 systemPalette.setColor(QPalette::BrightText, Qt::white);
28 systemPalette.setColor(QPalette::Highlight, accentColor);
29 systemPalette.setColor(QPalette::HighlightedText, Qt::white);
30 systemPalette.setColor(QPalette::Text, windowTextColor);
31 systemPalette.setColor(QPalette::ToolTipText, Qt::white);
32 systemPalette.setColor(QPalette::WindowText, windowTextColor);
33 systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledWindowTextColor);
34 systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledWindowTextColor);
35 theme->setPalette(QQuickTheme::System, systemPalette);
36}
37
38QT_END_NAMESPACE