Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquicklabsplatformiconloader.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
5
#
include
"qquicklabsplatformiconloader_p.h"
6
7
#
include
<
QtCore
/
qobject
.
h
>
8
#
include
<
QtCore
/
qmetaobject
.
h
>
9
#
include
<
QtQml
/
qqml
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
QQuickLabsPlatformIconLoader::QQuickLabsPlatformIconLoader(
int
slot, QObject *parent)
14
: m_parent(parent),
15
m_slot(slot),
16
m_enabled(
false
)
17
{
18
Q_ASSERT(slot != -1 && parent);
19
}
20
21
bool
QQuickLabsPlatformIconLoader
::
isEnabled
()
const
22
{
23
return
m_enabled;
24
}
25
26
void
QQuickLabsPlatformIconLoader
::
setEnabled
(
bool
enabled)
27
{
28
m_enabled = enabled;
29
if
(m_enabled)
30
loadIcon();
31
}
32
33
QIcon
QQuickLabsPlatformIconLoader
::
toQIcon
()
const
34
{
35
QIcon fallback = QPixmap::fromImage(image());
36
QIcon icon = QIcon::fromTheme(m_icon.name(), fallback);
37
icon.setIsMask(m_icon.isMask());
38
return
icon;
39
}
40
41
QQuickLabsPlatformIcon
QQuickLabsPlatformIconLoader
::
icon
()
const
42
{
43
return
m_icon;
44
}
45
46
void
QQuickLabsPlatformIconLoader
::
setIcon
(
const
QQuickLabsPlatformIcon
& icon)
47
{
48
m_icon = icon;
49
if
(m_enabled)
50
loadIcon();
51
}
52
53
void
QQuickLabsPlatformIconLoader
::loadIcon()
54
{
55
if
(m_icon.source().isEmpty()) {
56
clear(m_parent);
57
}
else
{
58
load(qmlEngine(m_parent), m_icon.source());
59
if
(m_slot != -1 && isLoading()) {
60
connectFinished(m_parent, m_slot);
61
m_slot = -1;
62
}
63
}
64
65
if
(!isLoading())
66
m_parent->metaObject()->method(m_slot).invoke(m_parent);
67
}
68
69
QT_END_NAMESPACE
QQuickLabsPlatformIconLoader
Definition
qquicklabsplatformiconloader_p.h:31
QQuickLabsPlatformIconLoader::setIcon
void setIcon(const QQuickLabsPlatformIcon &icon)
Definition
qquicklabsplatformiconloader.cpp:46
QQuickLabsPlatformIconLoader::icon
QQuickLabsPlatformIcon icon() const
Definition
qquicklabsplatformiconloader.cpp:41
QQuickLabsPlatformIconLoader::setEnabled
void setEnabled(bool enabled)
Definition
qquicklabsplatformiconloader.cpp:26
QQuickLabsPlatformIconLoader::isEnabled
bool isEnabled() const
Definition
qquicklabsplatformiconloader.cpp:21
QQuickLabsPlatformIconLoader::toQIcon
QIcon toQIcon() const
Definition
qquicklabsplatformiconloader.cpp:33
QQuickLabsPlatformIcon
Definition
qquicklabsplatformicon_p.h:30
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
labs
platform
qquicklabsplatformiconloader.cpp
Generated on
for Qt by
1.18.0