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
This commit is contained in:
Aaron J. Seigo 2007-06-20 06:45:08 +00:00
parent ac1d10f987
commit 5e2b8cfd95
2 changed files with 17 additions and 6 deletions

View File

@ -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()) {

View File

@ -19,7 +19,7 @@
#ifndef PLASMA_APPLET_H
#define PLASMA_APPLET_H
#include <QtGui/QGraphicsItemGroup>
#include <QtGui/QGraphicsItem>
#include <QtGui/QWidget>
#include <kplugininfo.h>
@ -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