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
14
15#if QT_CONFIG(shortcut)
16// qtdeclarative/src/quick/util/qquickshortcut.cpp
20#endif
21
24
26{
27 Q_OBJECT
28 Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
29
30public:
33
34 void registerTypes(const char *uri) override;
36
37private:
38#if QT_CONFIG(shortcut)
40#endif
41};
42
43QtQuickTemplates2Plugin::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
54{
55 // Intentionally empty: we use register/unregisterTypes() to do
56 // initialization and cleanup, as plugins are not unloaded on macOS.
57}
58
59void 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
68{
69#if QT_CONFIG(shortcut)
70 qt_quick_set_shortcut_context_matcher(originalContextMatcher);
71#endif
72}
73
74QT_END_NAMESPACE
75
76#include "qtquicktemplates2plugin.moc"
void registerTypes(const char *uri) override
Registers the QML types in the given uri.
QT_BEGIN_NAMESPACE Q_GHS_KEEP_REFERENCE(qml_register_types_QtQuick)
Q_GHS_KEEP_REFERENCE(QQuickTemplates_initializeModule)