PlasmaCore.Theme is registered by the inport

no more need to declare it every time -> memory saving
This commit is contained in:
Marco Martin 2011-10-30 17:53:20 +01:00
parent a2cf63e813
commit 6eba438a89
10 changed files with 21 additions and 21 deletions

View File

@ -22,6 +22,7 @@
#include "corebindingsplugin.h" #include "corebindingsplugin.h"
#include <QtDeclarative/qdeclarative.h> #include <QtDeclarative/qdeclarative.h>
#include <QDeclarativeContext>
#include <Plasma/FrameSvg> #include <Plasma/FrameSvg>
#include <Plasma/Svg> #include <Plasma/Svg>
@ -34,6 +35,16 @@
#include "dialog.h" #include "dialog.h"
#include "tooltip.h" #include "tooltip.h"
void CoreBindingsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
{
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
QDeclarativeContext *context = engine->rootContext();
ThemeProxy *theme = new ThemeProxy(context);
context->setContextProperty("theme", theme);
}
void CoreBindingsPlugin::registerTypes(const char *uri) void CoreBindingsPlugin::registerTypes(const char *uri)
{ {
Q_ASSERT(uri == QLatin1String("org.kde.plasma.core")); Q_ASSERT(uri == QLatin1String("org.kde.plasma.core"));

View File

@ -22,6 +22,7 @@
#ifndef COREBINDINGSPLUGIN_H #ifndef COREBINDINGSPLUGIN_H
#define COREBINDINGSPLUGIN_H #define COREBINDINGSPLUGIN_H
#include <QDeclarativeEngine>
#include <QDeclarativeExtensionPlugin> #include <QDeclarativeExtensionPlugin>
#include <Plasma/Service> #include <Plasma/Service>
@ -31,6 +32,7 @@ class CoreBindingsPlugin : public QDeclarativeExtensionPlugin
Q_OBJECT Q_OBJECT
public: public:
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
void registerTypes(const char *uri); void registerTypes(const char *uri);
}; };

View File

@ -33,9 +33,6 @@ Item {
signal clicked() signal clicked()
PlasmaCore.Theme {
id: theme
}
function pressButton() { function pressButton() {
if (button.enabled) if (button.enabled)

View File

@ -31,7 +31,6 @@ Item {
// Plasma API // Plasma API
property alias text: label.text // TODO: Not yet part of the common API property alias text: label.text // TODO: Not yet part of the common API
property QtObject theme: PlasmaCore.Theme { }
property alias view: surfaceLoader.sourceComponent property alias view: surfaceLoader.sourceComponent
property alias shadow: shadowLoader.sourceComponent property alias shadow: shadowLoader.sourceComponent

View File

@ -35,8 +35,4 @@ Text {
color: theme.textColor color: theme.textColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
PlasmaCore.Theme {
id: theme
}
} }

View File

@ -134,10 +134,6 @@ Item {
color: Qt.rgba(0,0,0,0.3) color: Qt.rgba(0,0,0,0.3)
} }
PlasmaCore.Theme {
id: theme
}
Rectangle { Rectangle {
id: handle id: handle
width: 6 width: 6

View File

@ -89,10 +89,6 @@ Item {
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5
PlasmaCore.Theme {
id: theme
}
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: hover id: hover

View File

@ -73,8 +73,6 @@ Item {
textInput.positionToRectangle(pos); textInput.positionToRectangle(pos);
} }
// Plasma API
property QtObject theme: PlasmaCore.Theme { }
// Set active focus to it's internal textInput. // Set active focus to it's internal textInput.
// Overriding QtQuick.Item forceActiveFocus function. // Overriding QtQuick.Item forceActiveFocus function.

View File

@ -34,9 +34,6 @@ Item {
signal clicked() signal clicked()
PlasmaCore.Theme {
id: theme
}
onFlatChanged: { onFlatChanged: {
surface.opacity = 1 surface.opacity = 1

View File

@ -24,6 +24,14 @@ ToolBar 0.1 ToolBar.qml
ToolButton 0.1 ToolButton.qml ToolButton 0.1 ToolButton.qml
ListItem 0.1 ToolButton.qml ListItem 0.1 ToolButton.qml
CommonDialog 0.1 CommonDialog.qml
Dialog 0.1 Dialog.qml
Page 0.1 Page.qml
PageStack 0.1 PageStack.qml
QueryDialog 0.1 QueryDialog.qml
SelectionDialog 0.1 SelectionDialog.qml
Window 0.1 Window.qml
TabBar 0.1 TabBar.qml TabBar 0.1 TabBar.qml
TabButton 0.1 TabButton.qml TabButton 0.1 TabButton.qml
TabGroup 0.1 TabGroup.qml TabGroup 0.1 TabGroup.qml