Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
6#include <QtQuickTemplates2/private/qquicktheme_p.h>
7
8#include <qfontdatabase.h>
9
11
13{
14 const auto defaultFontFamily = QLatin1String("Open Sans");
15 if (QFontDatabase::hasFamily(defaultFontFamily)) {
16 const QFont systemFont(QStringList{defaultFontFamily});
17 theme->setFont(QQuickTheme::System, systemFont);
18 }
19
20 const QColor accentColor = QColor::fromRgb(0x4fc1e9);
21 const QColor windowTextColor = QColor::fromRgb(0x434a54);
22 const QColor disabledWindowTextColor = QColor::fromRgb(0xccd1d9);
23
24 QPalette systemPalette;
27 systemPalette.setColor(QPalette::Highlight, accentColor);
29 systemPalette.setColor(QPalette::Text, windowTextColor);
31 systemPalette.setColor(QPalette::WindowText, windowTextColor);
32 systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledWindowTextColor);
33 systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledWindowTextColor);
34 theme->setPalette(QQuickTheme::System, systemPalette);
35}
36
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
static QColor fromRgb(QRgb rgb) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
Definition qcolor.cpp:2369
static bool hasFamily(const QString &family)
\reentrant
Definition qfont.h:22
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
@ Disabled
Definition qpalette.h:49
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition qpalette.h:146
@ HighlightedText
Definition qpalette.h:53
@ BrightText
Definition qpalette.h:52
@ ButtonText
Definition qpalette.h:52
@ WindowText
Definition qpalette.h:51
@ Highlight
Definition qpalette.h:53
@ ToolTipText
Definition qpalette.h:57
static void initialize(QQuickTheme *theme)
void setFont(Scope scope, const QFont &font)
void setPalette(Scope scope, const QPalette &palette)
\inmodule QtCore
Combined button and popup list for selecting options.
@ white
Definition qnamespace.h:31
QLatin1StringView QLatin1String
Definition qstringfwd.h:31