Qt
6.x
The Qt SDK
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
4
#include <QtQml/qqmlextensionplugin.h>
5
#include <QtQml/private/qqmlglobal_p.h>
6
#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
7
8
#if QT_CONFIG(shortcut)
9
#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
10
11
// qtdeclarative/src/quick/util/qquickshortcut.cpp
12
typedef
bool (*ShortcutContextMatcher)(
QObject
*,
Qt::ShortcutContext
);
13
extern
ShortcutContextMatcher
qt_quick_shortcut_context_matcher
();
14
extern
void
qt_quick_set_shortcut_context_matcher
(ShortcutContextMatcher
matcher
);
15
#endif
16
17
QT_BEGIN_NAMESPACE
18
19
Q_GHS_KEEP_REFERENCE
(
qml_register_types_QtQuick_Templates
);
20
Q_GHS_KEEP_REFERENCE
(
QQuickTemplates_initializeModule
);
21
22
class
QtQuickTemplates2Plugin
:
public
QQmlExtensionPlugin
23
{
24
Q_OBJECT
25
Q_PLUGIN_METADATA
(
IID
QQmlExtensionInterface_iid
)
26
27
public
:
28
QtQuickTemplates2Plugin
(
QObject
*
parent
=
nullptr
);
29
~QtQuickTemplates2Plugin
();
30
31
void
registerTypes
(
const
char
*uri)
override
;
32
void
unregisterTypes
()
override
;
33
34
private
:
35
#if QT_CONFIG(shortcut)
36
ShortcutContextMatcher originalContextMatcher;
37
#endif
38
};
39
40
QtQuickTemplates2Plugin::QtQuickTemplates2Plugin
(
QObject
*
parent
)
41
:
QQmlExtensionPlugin
(
parent
)
42
{
43
volatile
auto
registration
= &
qml_register_types_QtQuick_Templates
;
44
volatile
auto
initialization = &
QQuickTemplates_initializeModule
;
45
46
Q_UNUSED
(
registration
)
47
Q_UNUSED
(initialization)
48
}
49
50
QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin
()
51
{
52
// Intentionally empty: we use register/unregisterTypes() to do
53
// initialization and cleanup, as plugins are not unloaded on macOS.
54
}
55
56
void
QtQuickTemplates2Plugin::registerTypes
(
const
char
*
/*uri*/
)
57
{
58
#if QT_CONFIG(shortcut)
59
originalContextMatcher =
qt_quick_shortcut_context_matcher
();
60
qt_quick_set_shortcut_context_matcher
(
QQuickShortcutContext::matcher
);
61
#endif
62
}
63
64
void
QtQuickTemplates2Plugin::unregisterTypes
()
65
{
66
#if QT_CONFIG(shortcut)
67
qt_quick_set_shortcut_context_matcher
(originalContextMatcher);
68
#endif
69
}
70
71
QT_END_NAMESPACE
72
73
#include "qtquicktemplates2plugin.moc"
QObject
\inmodule QtCore
Definition
qobject.h:90
QObject::parent
QObject * parent() const
Returns a pointer to the parent object.
Definition
qobject.h:311
QQmlExtensionPlugin
The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins with custom ...
Definition
qqmlextensionplugin.h:28
QtQuickTemplates2Plugin
Definition
qtquicktemplates2plugin.cpp:23
QtQuickTemplates2Plugin::QtQuickTemplates2Plugin
QtQuickTemplates2Plugin(QObject *parent=nullptr)
Definition
qtquicktemplates2plugin.cpp:40
QtQuickTemplates2Plugin::registerTypes
void registerTypes(const char *uri) override
Registers the QML types in the given uri.
Definition
qtquicktemplates2plugin.cpp:56
QtQuickTemplates2Plugin::unregisterTypes
void unregisterTypes() override
Definition
qtquicktemplates2plugin.cpp:64
QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin
~QtQuickTemplates2Plugin()
Definition
qtquicktemplates2plugin.cpp:50
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
Qt::ShortcutContext
ShortcutContext
Definition
qnamespace.h:1287
QtPluginMetaDataKeys::IID
@ IID
QQmlExtensionInterface_iid
#define QQmlExtensionInterface_iid
Definition
qqmlextensioninterface.h:41
Q_GHS_KEEP_REFERENCE
#define Q_GHS_KEEP_REFERENCE(S)
Definition
qqmlextensionplugin.h:14
registration
static const QQmlModuleRegistration registration("QtQml", qml_register_types_QtQml)
qt_quick_set_shortcut_context_matcher
Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher)
Definition
qquickshortcut.cpp:84
qt_quick_shortcut_context_matcher
Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher()
Definition
qquickshortcut.cpp:79
Q_OBJECT
#define Q_OBJECT
Definition
qtmetamacros.h:117
Q_PLUGIN_METADATA
#define Q_PLUGIN_METADATA(x)
Definition
qtmetamacros.h:54
Q_UNUSED
#define Q_UNUSED(x)
Definition
qtpreprocessorsupport.h:20
QQuickTemplates_initializeModule
QT_BEGIN_NAMESPACE void QQuickTemplates_initializeModule()
Definition
qtquicktemplates2global.cpp:25
qml_register_types_QtQuick_Templates
Q_QUICKTEMPLATES2_PRIVATE_EXPORT void qml_register_types_QtQuick_Templates()
matcher
static const auto matcher
[0]
Definition
src_corelib_text_qbytearraymatcher.cpp:5
QQuickShortcutContext::matcher
static bool matcher(QObject *object, Qt::ShortcutContext context)
Definition
qquickshortcutcontext.cpp:40
parent
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
Definition
uiaclientinterfaces_p.h:209
qtdeclarative
src
quicktemplates
qtquicktemplates2plugin.cpp
Generated by
1.9.7