remove deprecated property

This commit is contained in:
Marco Martin 2012-01-09 11:41:28 +01:00
parent b566382d48
commit edda55f015
4 changed files with 24 additions and 24 deletions

View File

@ -21,6 +21,8 @@
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeItem>
#include "qrangemodel.h"
@ -31,6 +33,8 @@
#include "qmenuitem.h"
#include "kdialogproxy.h"
Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
class BKSingleton
{
public:
@ -47,31 +51,32 @@ EngineBookKeeping *EngineBookKeeping::self()
return &privateBKSelf->self;
}
QDeclarativeEngine *EngineBookKeeping::engineFor(QDeclarativeItem *item) const
QDeclarativeEngine *EngineBookKeeping::engineFor(QObject *item) const
{
foreach (QDeclarativeEngine *engine, m_engines) {
QObject *root = engine->rootContext()->contextObject();
QObject *candidate = item;
while (candidate) {
if (candidate == root) {
return engine;
}
candidate = candidate->parent();
}
}
return 0;
}
void EngineBookKeeping::insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine)
void EngineBookKeeping::insertEngine(QDeclarativeEngine *engine)
{
m_engines.insert(plugin, engine);
}
void EngineBookKeeping::removePlugin(PlasmaComponentsPlugin *plugin)
{
m_engines.remove(plugin);
m_engines.insert(engine);
}
PlasmaComponentsPlugin::~PlasmaComponentsPlugin()
{
EngineBookKeeping::self()->removePlugin(this);
}
void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
{
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
EngineBookKeeping::self()->insertPlugin(this, engine);
EngineBookKeeping::self()->insertEngine(engine);
}
void PlasmaComponentsPlugin::registerTypes(const char *uri)

View File

@ -21,7 +21,7 @@
#define PLASMACOMPONENTSPLUGIN_H
#include <QDeclarativeExtensionPlugin>
#include <QHash>
#include <QSet>
class QDeclarativeEngine;
class QDeclarativeItem;
@ -33,12 +33,11 @@ public:
EngineBookKeeping();
static EngineBookKeeping *self();
void insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine);
void removePlugin(PlasmaComponentsPlugin *plugin);
QDeclarativeEngine *engineFor(QDeclarativeItem *item) const;
void insertEngine(QDeclarativeEngine *engine);
QDeclarativeEngine *engineFor(QObject *item) const;
private:
QHash <PlasmaComponentsPlugin*, QDeclarativeEngine*> m_engines;
QSet <QDeclarativeEngine*> m_engines;
};
class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin
@ -46,11 +45,8 @@ class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin
Q_OBJECT
public:
~PlasmaComponentsPlugin();
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
void registerTypes(const char *uri);
};
Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
#endif

View File

@ -26,10 +26,11 @@
#include <QGraphicsView>
#include <QDeclarativeItem>
#include "plasmacomponentsplugin.h"
QMenuProxy::QMenuProxy (QObject *parent)
: QObject(parent),
m_status(DialogStatus::Closed)
{
{qDebug()<<"AAAAAA"<<EngineBookKeeping::self()->engineFor(this);
m_menu = new QMenu(0);
connect(m_menu, SIGNAL(triggered(QAction *)),
this, SLOT(itemTriggered(QAction *)));

View File

@ -81,8 +81,6 @@ CommonDialog {
property int selectedIndex: -1
property Component delegate: defaultDelegate
privateCloseIcon: true
Component {
id: defaultDelegate