Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtquicktemplates2plugin.cpp
Go to the documentation of this file.
1
// Copyright (C) 2020 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
<
QtQml
/
qqmlextensionplugin
.
h
>
6
#
include
<
QtQml
/
private
/
qqmlglobal_p
.
h
>
7
#
include
<
QtQuickTemplates2
/
private
/
qtquicktemplates2global_p
.
h
>
8
9
#
if
QT_CONFIG
(
shortcut
)
10
#
include
<
QtQuickTemplates2
/
private
/
qquickshortcutcontext_p_p
.
h
>
11
#
endif
12
13
QT_BEGIN_NAMESPACE
14
15
#
if
QT_CONFIG
(
shortcut
)
16
// qtdeclarative/src/quick/util/qquickshortcut.cpp
17
typedef
bool
(*
ShortcutContextMatcher
)(
QObject
*,
Qt
::
ShortcutContext
);
18
extern
ShortcutContextMatcher
qt_quick_shortcut_context_matcher
();
19
extern
void
qt_quick_set_shortcut_context_matcher
(
ShortcutContextMatcher
matcher
);
20
#
endif
21
22
Q_GHS_KEEP_REFERENCE
(
qml_register_types_QtQuick_Templates
);
23
Q_GHS_KEEP_REFERENCE
(
QQuickTemplates_initializeModule
);
24
25
class
QtQuickTemplates2Plugin
:
public
QQmlExtensionPlugin
26
{
27
Q_OBJECT
28
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
29
30
public
:
31
QtQuickTemplates2Plugin
(
QObject
*
parent
=
nullptr
);
32
~
QtQuickTemplates2Plugin
();
33
34
void
registerTypes
(
const
char
*uri)
override
;
35
void
unregisterTypes
()
override
;
36
37
private
:
38
#
if
QT_CONFIG
(
shortcut
)
39
ShortcutContextMatcher
originalContextMatcher
;
40
#
endif
41
};
42
43
QtQuickTemplates2Plugin
::QtQuickTemplates2Plugin(QObject *parent)
44
: QQmlExtensionPlugin(parent)
45
{
46
volatile
auto
registration = &qml_register_types_QtQuick_Templates;
47
volatile
auto
initialization = &QQuickTemplates_initializeModule;
48
49
Q_UNUSED(registration)
50
Q_UNUSED(initialization)
51
}
52
53
QtQuickTemplates2Plugin
::~
QtQuickTemplates2Plugin
()
54
{
55
// Intentionally empty: we use register/unregisterTypes() to do
56
// initialization and cleanup, as plugins are not unloaded on macOS.
57
}
58
59
void
QtQuickTemplates2Plugin
::
registerTypes
(
const
char
*
/*uri*/
)
60
{
61
#
if
QT_CONFIG
(
shortcut
)
62
originalContextMatcher = qt_quick_shortcut_context_matcher();
63
qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
64
#
endif
65
}
66
67
void
QtQuickTemplates2Plugin
::
unregisterTypes
()
68
{
69
#
if
QT_CONFIG
(
shortcut
)
70
qt_quick_set_shortcut_context_matcher(originalContextMatcher);
71
#
endif
72
}
73
74
QT_END_NAMESPACE
75
76
#
include
"qtquicktemplates2plugin.moc"
QtQuickTemplates2Plugin
Definition
qtquicktemplates2plugin.cpp:26
QtQuickTemplates2Plugin::registerTypes
void registerTypes(const char *uri) override
Registers the QML types in the given uri.
Definition
qtquicktemplates2plugin.cpp:59
QtQuickTemplates2Plugin::unregisterTypes
void unregisterTypes() override
Definition
qtquicktemplates2plugin.cpp:67
QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin
~QtQuickTemplates2Plugin()
Definition
qtquicktemplates2plugin.cpp:53
Q_GHS_KEEP_REFERENCE
QT_BEGIN_NAMESPACE Q_GHS_KEEP_REFERENCE(qml_register_types_QtQuick)
Q_GHS_KEEP_REFERENCE
Q_GHS_KEEP_REFERENCE(QQuickTemplates_initializeModule)
qtdeclarative
src
quicktemplates
qtquicktemplates2plugin.cpp
Generated on
for Qt by
1.16.1