Qt 6.x
The Qt SDK
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
9
11{
12 QFont systemFont;
13 systemFont.setFamilies(QStringList{QLatin1String("Open Sans")});
14 theme->setFont(QQuickTheme::System, systemFont);
15
16 const QColor accentColor = QColor::fromRgb(0x4fc1e9);
17 const QColor windowTextColor = QColor::fromRgb(0x434a54);
18 const QColor disabledWindowTextColor = QColor::fromRgb(0xccd1d9);
19
20 QPalette systemPalette;
23 systemPalette.setColor(QPalette::Highlight, accentColor);
25 systemPalette.setColor(QPalette::Text, windowTextColor);
27 systemPalette.setColor(QPalette::WindowText, windowTextColor);
28 systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledWindowTextColor);
29 systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledWindowTextColor);
30 theme->setPalette(QQuickTheme::System, systemPalette);
31}
32
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
\reentrant
Definition qfont.h:20
void setFamilies(const QStringList &)
Definition qfont.cpp:2491
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
@ Disabled
Definition qpalette.h:48
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:145
@ HighlightedText
Definition qpalette.h:52
@ BrightText
Definition qpalette.h:51
@ ButtonText
Definition qpalette.h:51
@ WindowText
Definition qpalette.h:50
@ Highlight
Definition qpalette.h:52
@ ToolTipText
Definition qpalette.h:56
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:30
QLatin1StringView QLatin1String
Definition qstringfwd.h:31