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
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
12typedef bool (*ShortcutContextMatcher)(QObject *, Qt::ShortcutContext);
13extern ShortcutContextMatcher qt_quick_shortcut_context_matcher();
14extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher);
15#endif
16
18
21
23{
26
27public:
30
31 void registerTypes(const char *uri) override;
32 void unregisterTypes() override;
33
34private:
35#if QT_CONFIG(shortcut)
36 ShortcutContextMatcher originalContextMatcher;
37#endif
38};
39
49
51{
52 // Intentionally empty: we use register/unregisterTypes() to do
53 // initialization and cleanup, as plugins are not unloaded on macOS.
54}
55
57{
58#if QT_CONFIG(shortcut)
59 originalContextMatcher = qt_quick_shortcut_context_matcher();
61#endif
62}
63
65{
66#if QT_CONFIG(shortcut)
67 qt_quick_set_shortcut_context_matcher(originalContextMatcher);
68#endif
69}
70
72
73#include "qtquicktemplates2plugin.moc"
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins with custom ...
QtQuickTemplates2Plugin(QObject *parent=nullptr)
void registerTypes(const char *uri) override
Registers the QML types in the given uri.
Combined button and popup list for selecting options.
ShortcutContext
#define QQmlExtensionInterface_iid
static const QQmlModuleRegistration registration("QtQml", qml_register_types_QtQml)
Q_QUICK_EXPORT ContextMatcher qt_quick_shortcut_context_matcher()
Q_QUICK_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher)
#define Q_OBJECT
#define Q_PLUGIN_METADATA(x)
#define Q_UNUSED(x)
QT_BEGIN_NAMESPACE void QQuickTemplates_initializeModule()
Q_QUICKTEMPLATES2_EXPORT void qml_register_types_QtQuick_Templates()
#define Q_GHS_KEEP_REFERENCE(S)
static const auto matcher
[0]
static bool matcher(QObject *object, Qt::ShortcutContext context)