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:
parent
ac1d10f987
commit
5e2b8cfd95
14
applet.cpp
14
applet.cpp
@ -77,19 +77,18 @@ Applet::Applet(QGraphicsItem *parent,
|
|||||||
const QString& serviceID,
|
const QString& serviceID,
|
||||||
int appletId)
|
int appletId)
|
||||||
: QObject(0),
|
: QObject(0),
|
||||||
QGraphicsItemGroup(parent),
|
QGraphicsItem(parent),
|
||||||
d(new Private(KService::serviceByStorageId(serviceID), appletId))
|
d(new Private(KService::serviceByStorageId(serviceID), appletId))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Applet::Applet(QObject* parent, const QStringList& args)
|
Applet::Applet(QObject* parent, const QStringList& args)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
QGraphicsItemGroup(0),
|
QGraphicsItem(0),
|
||||||
d(new Private(KService::serviceByStorageId(args[0]), args[1].toInt()))
|
d(new Private(KService::serviceByStorageId(args[0]), args[1].toInt()))
|
||||||
{
|
{
|
||||||
// the brain damage seen in the initialization list is due to the
|
// the brain damage seen in the initialization list is due to the
|
||||||
// rediculous inflexibility of KService::createInstance
|
// inflexibility of KService::createInstance
|
||||||
// too bad i couldn't convince others that this was a real issue.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Applet::~Applet()
|
Applet::~Applet()
|
||||||
@ -146,6 +145,13 @@ QString Applet::name()
|
|||||||
return d->appletDescription->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
|
FormFactor Applet::formFactor() const
|
||||||
{
|
{
|
||||||
if (!scene()) {
|
if (!scene()) {
|
||||||
|
9
applet.h
9
applet.h
@ -19,7 +19,7 @@
|
|||||||
#ifndef PLASMA_APPLET_H
|
#ifndef PLASMA_APPLET_H
|
||||||
#define PLASMA_APPLET_H
|
#define PLASMA_APPLET_H
|
||||||
|
|
||||||
#include <QtGui/QGraphicsItemGroup>
|
#include <QtGui/QGraphicsItem>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
#include <kplugininfo.h>
|
#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
|
Q_OBJECT
|
||||||
|
|
||||||
@ -173,6 +173,11 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
|
|||||||
**/
|
**/
|
||||||
QString name();
|
QString name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reimplemented from QGraphicsItem
|
||||||
|
**/
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emit this signal when your applet needs to take (or lose) keyboard
|
* Emit this signal when your applet needs to take (or lose) keyboard
|
||||||
|
Loading…
Reference in New Issue
Block a user