Made applet a QWidget/QGraphicsItemGroup, moved plasma lib building from workspace to plasma dir, added applet directory and test applet directory

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638182
This commit is contained in:
Matt Broadstone 2007-03-01 01:09:20 +00:00
parent af51cd0360
commit 390e97b48c
2 changed files with 9 additions and 11 deletions

View File

@ -56,10 +56,11 @@ class Applet::Private
QStringList loadedEngines;
};
Applet::Applet(QWidget* parent,
Applet::Applet(QGraphicsItem *parent,
KService::Ptr appletDescription,
int id)
: QWidget(parent),
: QWidget(0),
QGraphicsItemGroup(parent),
d(new Private(appletDescription, id))
{
}
@ -124,12 +125,10 @@ QString Applet::instanceName() const
return d->appletDescription->library() + QString::number(d->id);
}
void Applet::watchForFocus(QWidget* widget, bool watch)
void Applet::watchForFocus(QObject *widget, bool watch)
{
if (!widget)
{
return;
}
int index = d->watchedForFocus.indexOf(widget);
if (watch)
@ -149,10 +148,8 @@ void Applet::watchForFocus(QWidget* widget, bool watch)
void Applet::needsFocus(bool focus)
{
if (focus == hasFocus())
{
if (focus == QWidget::hasFocus() || focus == QGraphicsItem::hasFocus())
return;
}
emit requestFocus(focus);
}

View File

@ -19,6 +19,7 @@
#ifndef PLASMA_APPLET_H
#define PLASMA_APPLET_H
#include <QGraphicsItemGroup>
#include <QWidget>
#include <ksharedconfig.h>
@ -29,14 +30,14 @@
namespace Plasma
{
class KDE_EXPORT Applet : public QWidget
class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
{
Q_OBJECT
public:
typedef QList<Applet*> List;
Applet(QWidget* parent,
Applet(QGraphicsItem* parent,
KService::Ptr appletDescription,
int id);
~Applet();
@ -89,7 +90,7 @@ class KDE_EXPORT Applet : public QWidget
* @param widget the widget to watch for keyboard focus
* @param watch whether to start watching the widget, or to stop doing so
*/
void watchForFocus(QWidget* widget, bool watch = true);
void watchForFocus(QObject *widget, bool watch = true);
/**
* Call this whenever focus is needed or not needed. You do not have to