summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-01-20 03:11:29 +0000
committerDavid Edmundson <[email protected]>2017-01-23 17:02:14 +0000
commit63cfbd991e0146044d716c62dec1a48e96138c68 (patch)
tree591f0aed8a7e3cd77d6009e2fad61e819b757435
parentc11aac0f58628825ee0e7023de0d88c2f3d9155e (diff)
Remove pointless QObject inheritance in model item
Summary: We don't emit anything or use properties or anything else that requires MOC. We want to keep model items light. The emitDataChanged in setRunning still works because that's part of QStandardItem. Memory management is the same beacuse the QStandardItemModel takes ownership in appendRow(). Test Plan: Opened widget explorer. Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4218
-rw-r--r--components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp13
-rw-r--r--components/shellprivate/widgetexplorer/plasmaappletitemmodel_p.h8
2 files changed, 5 insertions, 16 deletions
diff --git a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp
index 0c05a8a..6169721 100644
--- a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp
+++ b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp
@@ -31,10 +31,8 @@
#include <KPackage/PackageLoader>
#include <KDeclarative/KDeclarative>
-PlasmaAppletItem::PlasmaAppletItem(PlasmaAppletItemModel *model,
- const KPluginInfo& info)
- : QObject(model),
- m_model(model),
+PlasmaAppletItem::PlasmaAppletItem(const KPluginInfo& info):
+ AbstractItem(),
m_info(info),
m_runningCount(0),
m_local(false)
@@ -179,11 +177,6 @@ QStringList PlasmaAppletItem::mimeTypes() const
return types;
}
-PlasmaAppletItemModel* PlasmaAppletItem::appletItemModel()
-{
- return m_model;
-}
-
QVariant PlasmaAppletItem::data(int role) const
{
switch (role) {
@@ -305,7 +298,7 @@ void PlasmaAppletItemModel::populateModel(const QStringList &whatChanged)
//qDebug() << info.pluginName() << " is the name of the plugin at" << info.entryPath();
//qDebug() << info.name() << info.property("X-Plasma-Thumbnail");
- appendRow(new PlasmaAppletItem(this, info));
+ appendRow(new PlasmaAppletItem(info));
}
emit modelPopulated();
diff --git a/components/shellprivate/widgetexplorer/plasmaappletitemmodel_p.h b/components/shellprivate/widgetexplorer/plasmaappletitemmodel_p.h
index 2c649c8..f1172df 100644
--- a/components/shellprivate/widgetexplorer/plasmaappletitemmodel_p.h
+++ b/components/shellprivate/widgetexplorer/plasmaappletitemmodel_p.h
@@ -29,12 +29,10 @@ class PlasmaAppletItemModel;
/**
* Implementation of the KCategorizedItemsViewModels::AbstractItem
*/
-class PlasmaAppletItem : public QObject, public KCategorizedItemsViewModels::AbstractItem
+class PlasmaAppletItem : public KCategorizedItemsViewModels::AbstractItem
{
- Q_OBJECT
-
public:
- PlasmaAppletItem(PlasmaAppletItemModel *model, const KPluginInfo& info);
+ PlasmaAppletItem(const KPluginInfo& info);
QString pluginName() const;
QString name() const override;
@@ -49,7 +47,6 @@ public:
int running() const override;
bool isLocal() const;
- PlasmaAppletItemModel* appletItemModel();
bool matches(const QString &pattern) const override;
//set how many instances of this applet are running
@@ -59,7 +56,6 @@ public:
QStringList mimeTypes() const;
private:
- PlasmaAppletItemModel * m_model;
KPluginInfo m_info;
QString m_screenshot;
QString m_icon;