move AppletQuickItem in libplasmaquick

This commit is contained in:
Marco Martin 2014-02-05 17:23:52 +01:00
parent c363b33b43
commit f8b649fba9
6 changed files with 18 additions and 14 deletions

View File

@ -1,6 +1,7 @@
project(PlasmaQuick)
set(plasmaquick_LIB_SRC
appletquickitem.cpp
plasmaquickview.cpp
configmodel.cpp
configview.cpp
@ -36,6 +37,7 @@ generate_export_header(KF5PlasmaQuick BASE_NAME PlasmaQuick)
set(plasmaquick_LIB_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}/plasmaquick_export.h
appletquickitem.h
plasmaquickview.h
configview.h
configmodel.h

View File

@ -397,6 +397,17 @@ AppletQuickItem::~AppletQuickItem()
AppletQuickItemPrivate::s_rootObjects.remove(d->qmlObject->engine());
}
AppletQuickItem *AppletQuickItem::qmlAttachedProperties(QObject *object)
{
//at the moment of the attached object creation, the root item is the only one that hasn't a parent
//only way to avoid creation of this attached for everybody but the root item
if (!object->parent() && AppletQuickItemPrivate::s_rootObjects.contains(QtQml::qmlEngine(object))) {
return AppletQuickItemPrivate::s_rootObjects.value(QtQml::qmlEngine(object));
} else {
return 0;
}
}
Plasma::Applet *AppletQuickItem::applet() const
{
return d->applet;

View File

@ -28,8 +28,9 @@
#include <Plasma/Package>
#include "appletquickitem_p.h"
#include "private/appletquickitem_p.h"
#include <plasmaquick/plasmaquick_export.h>
namespace Plasma {
class Applet;
@ -40,7 +41,7 @@ namespace KDeclarative {
}
class AppletQuickItem : public QQuickItem
class PLASMAQUICK_EXPORT AppletQuickItem : public QQuickItem
{
Q_OBJECT
@ -105,16 +106,7 @@ public:
void setExpanded(bool expanded);
////NEEDED BY QML TO CREATE ATTACHED PROPERTIES
static AppletQuickItem *qmlAttachedProperties(QObject *object)
{
//at the moment of the attached object creation, the root item is the only one that hasn't a parent
//only way to avoid creation of this attached for everybody but the root item
if (!object->parent() && AppletQuickItemPrivate::s_rootObjects.contains(QtQml::qmlEngine(object))) {
return AppletQuickItemPrivate::s_rootObjects.value(QtQml::qmlEngine(object));
} else {
return 0;
}
}
static AppletQuickItem *qmlAttachedProperties(QObject *object);
Q_SIGNALS:

View File

@ -10,7 +10,6 @@ endif()
set(declarative_appletscript_SRCS
plasmoid/declarativeappletscript.cpp
plasmoid/appletquickitem.cpp
plasmoid/appletinterface.cpp
plasmoid/containmentinterface.cpp
plasmoid/declarativeappletscript.cpp

View File

@ -29,7 +29,7 @@
#include <Plasma/Applet>
#include <Plasma/Theme>
#include "appletquickitem.h"
#include <appletquickitem.h>
#include "declarativeappletscript.h"
class QAction;