From 5e2b8cfd952901ed5a2eb48decd76a0d7cb6d1f5 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 20 Jun 2007 06:45:08 +0000 Subject: [PATCH] make applet a QGraphicsItem not a Group; as bibr explained to me on irc this evening a group is really, really a group ;) iow, the children lose all sense of identity. this causes all sorts of problems for building the sort of interfaces we are aiming for. however, making them items makes it possible to drag children outside of their parents (c.f. the button applet) which causes another set of problems. i'll look into this tomorrow though. it's 01:00 and i was trying not to work on kde tonight. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=677904 --- applet.cpp | 14 ++++++++++---- applet.h | 9 +++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/applet.cpp b/applet.cpp index d72ed7c7c..70f876e8d 100644 --- a/applet.cpp +++ b/applet.cpp @@ -77,19 +77,18 @@ Applet::Applet(QGraphicsItem *parent, const QString& serviceID, int appletId) : QObject(0), - QGraphicsItemGroup(parent), + QGraphicsItem(parent), d(new Private(KService::serviceByStorageId(serviceID), appletId)) { } Applet::Applet(QObject* parent, const QStringList& args) : QObject(parent), - QGraphicsItemGroup(0), + QGraphicsItem(0), d(new Private(KService::serviceByStorageId(args[0]), args[1].toInt())) { // the brain damage seen in the initialization list is due to the - // rediculous inflexibility of KService::createInstance - // too bad i couldn't convince others that this was a real issue. + // inflexibility of KService::createInstance } Applet::~Applet() @@ -146,6 +145,13 @@ QString Applet::name() return d->appletDescription->name(); } +void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(painter) + Q_UNUSED(option) + Q_UNUSED(widget) +} + FormFactor Applet::formFactor() const { if (!scene()) { diff --git a/applet.h b/applet.h index 75a6c9639..b401f007f 100644 --- a/applet.h +++ b/applet.h @@ -19,7 +19,7 @@ #ifndef PLASMA_APPLET_H #define PLASMA_APPLET_H -#include +#include #include #include @@ -38,7 +38,7 @@ class DataEngine; * * */ -class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup +class PLASMA_EXPORT Applet : public QObject, public QGraphicsItem { Q_OBJECT @@ -173,6 +173,11 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup **/ QString name(); + /** + * Reimplemented from QGraphicsItem + **/ + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + Q_SIGNALS: /** * Emit this signal when your applet needs to take (or lose) keyboard