blob: b188dcb4b6b734b9ef7fd0d7daec76910f4437e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwasmtheme.h"
#include <QtCore/qvariant.h>
#include <QFontDatabase>
#include <QList>
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QWasmTheme::QWasmTheme()
{
for (auto family : QFontDatabase::families())
if (QFontDatabase::isFixedPitch(family))
fixedFont = new QFont(family);
}
QWasmTheme::~QWasmTheme()
{
if (fixedFont)
delete fixedFont;
}
QVariant QWasmTheme::themeHint(ThemeHint hint) const
{
if (hint == QPlatformTheme::StyleNames)
return QVariant(QStringList() << "Fusion"_L1);
if (hint == QPlatformTheme::UiEffects)
return QVariant(int(HoverEffect));
return QPlatformTheme::themeHint(hint);
}
const QFont *QWasmTheme::font(Font type) const
{
if (type == QPlatformTheme::FixedFont) {
return fixedFont;
}
return nullptr;
}
QT_END_NAMESPACE
|