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
qwasmbase64iconstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5
6#include <QtCore/qfile.h>
7
9
10Q_GLOBAL_STATIC(Base64IconStore, globalWasmWindowIconStore);
11
13{
14 QString iconSources[static_cast<size_t>(IconType::Size)] = {
15 QStringLiteral(":/wasm-window/maximize.svg"), QStringLiteral(":/wasm-window/qtlogo.svg"),
16 QStringLiteral(":/wasm-window/restore.svg"), QStringLiteral(":/wasm-window/x.svg")
17 };
18
19 for (size_t iconType = static_cast<size_t>(IconType::First);
20 iconType < static_cast<size_t>(IconType::Size); ++iconType) {
21 QFile svgFile(iconSources[static_cast<size_t>(iconType)]);
22 if (!svgFile.open(QIODevice::ReadOnly))
23 Q_ASSERT(false); // A resource should always be opened.
24 m_storage[static_cast<size_t>(iconType)] = svgFile.readAll().toBase64();
25 }
26}
27
29
31{
32 return globalWasmWindowIconStore();
33}
34
35std::string_view Base64IconStore::getIcon(IconType type) const
36{
37 return m_storage[static_cast<size_t>(type)];
38}
39
std::string_view getIcon(IconType type) const
static Base64IconStore * get()
\inmodule QtCore
Definition qfile.h:93
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
GLenum type
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)