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#include <KLocalizedQmlContext>
20
21void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
22{
24
25 QQmlContext *context = engine->rootContext();
26
27 if (!context->contextObject()) {
28 KLocalizedQmlContext *localizedContextObject = new KLocalizedQmlContext(engine);
29 context->setContextObject(localizedContextObject);
30 }
31 // This ensures that importing plasmacore will make any KSvg use the current lasma theme
32 new Plasma::Theme(engine);
33}
34
35void CoreBindingsPlugin::registerTypes(const char *uri)
36{
37 Q_ASSERT(uri == QByteArray("org.kde.plasma.core"));
38
39 // HACK make properties like "opacity" work that are in REVISION 1 of QWindow
40 qmlRegisterRevision<QWindow, 1>(uri, 2, 0);
41 qmlRegisterRevision<QQuickItem, 1>(uri, 2, 0);
42 qmlRegisterExtendedType<QAction, ActionExtension>(uri, 2, 0, "Action");
43}
44
45#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 Sat Dec 21 2024 17:01:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.