Libplasma

corebindingsplugin.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Alan Alpert <alan.alpert@nokia.com>
3 SPDX-FileCopyrightText: 2010 Ménard Alexis <menard@kde.org>
4 SPDX-FileCopyrightText: 2010 Marco Martin <mart@kde.org>
5 SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#include "corebindingsplugin.h"
11
12#include <QDebug>
13#include <QQmlContext>
14#include <QWindow>
15
16#include <KLocalizedContext>
17
18#include "action.h"
19
20void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
21{
23
24 QQmlContext *context = engine->rootContext();
25
26 if (!context->contextObject()) {
27 KLocalizedContext *localizedContextObject = new KLocalizedContext(engine);
28 context->setContextObject(localizedContextObject);
29 }
30 // This ensures that importing plasmacore will make any KSvg use the current lasma theme
31 new Plasma::Theme(engine);
32}
33
34void CoreBindingsPlugin::registerTypes(const char *uri)
35{
36 Q_ASSERT(uri == QByteArray("org.kde.plasma.core"));
37
38 // HACK make properties like "opacity" work that are in REVISION 1 of QWindow
39 qmlRegisterRevision<QWindow, 1>(uri, 2, 0);
40 qmlRegisterRevision<QQuickItem, 1>(uri, 2, 0);
41 qmlRegisterExtendedType<QAction, ActionExtension>(uri, 2, 0, "Action");
42}
43
44#include "moc_corebindingsplugin.cpp"
Interface to the Plasma theme.
Definition theme.h:40
QObject * contextObject() const const
void setContextObject(QObject *object)
QQmlContext * rootContext() const const
virtual void initializeEngine(QQmlEngine *engine, const char *uri) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.