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:
parent
af51cd0360
commit
390e97b48c
13
applet.cpp
13
applet.cpp
@ -56,10 +56,11 @@ class Applet::Private
|
|||||||
QStringList loadedEngines;
|
QStringList loadedEngines;
|
||||||
};
|
};
|
||||||
|
|
||||||
Applet::Applet(QWidget* parent,
|
Applet::Applet(QGraphicsItem *parent,
|
||||||
KService::Ptr appletDescription,
|
KService::Ptr appletDescription,
|
||||||
int id)
|
int id)
|
||||||
: QWidget(parent),
|
: QWidget(0),
|
||||||
|
QGraphicsItemGroup(parent),
|
||||||
d(new Private(appletDescription, id))
|
d(new Private(appletDescription, id))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -124,12 +125,10 @@ QString Applet::instanceName() const
|
|||||||
return d->appletDescription->library() + QString::number(d->id);
|
return d->appletDescription->library() + QString::number(d->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::watchForFocus(QWidget* widget, bool watch)
|
void Applet::watchForFocus(QObject *widget, bool watch)
|
||||||
{
|
{
|
||||||
if (!widget)
|
if (!widget)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int index = d->watchedForFocus.indexOf(widget);
|
int index = d->watchedForFocus.indexOf(widget);
|
||||||
if (watch)
|
if (watch)
|
||||||
@ -149,10 +148,8 @@ void Applet::watchForFocus(QWidget* widget, bool watch)
|
|||||||
|
|
||||||
void Applet::needsFocus(bool focus)
|
void Applet::needsFocus(bool focus)
|
||||||
{
|
{
|
||||||
if (focus == hasFocus())
|
if (focus == QWidget::hasFocus() || focus == QGraphicsItem::hasFocus())
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
emit requestFocus(focus);
|
emit requestFocus(focus);
|
||||||
}
|
}
|
||||||
|
7
applet.h
7
applet.h
@ -19,6 +19,7 @@
|
|||||||
#ifndef PLASMA_APPLET_H
|
#ifndef PLASMA_APPLET_H
|
||||||
#define PLASMA_APPLET_H
|
#define PLASMA_APPLET_H
|
||||||
|
|
||||||
|
#include <QGraphicsItemGroup>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <ksharedconfig.h>
|
#include <ksharedconfig.h>
|
||||||
@ -29,14 +30,14 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class KDE_EXPORT Applet : public QWidget
|
class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QList<Applet*> List;
|
typedef QList<Applet*> List;
|
||||||
|
|
||||||
Applet(QWidget* parent,
|
Applet(QGraphicsItem* parent,
|
||||||
KService::Ptr appletDescription,
|
KService::Ptr appletDescription,
|
||||||
int id);
|
int id);
|
||||||
~Applet();
|
~Applet();
|
||||||
@ -89,7 +90,7 @@ class KDE_EXPORT Applet : public QWidget
|
|||||||
* @param widget the widget to watch for keyboard focus
|
* @param widget the widget to watch for keyboard focus
|
||||||
* @param watch whether to start watching the widget, or to stop doing so
|
* @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
|
* Call this whenever focus is needed or not needed. You do not have to
|
||||||
|
Loading…
Reference in New Issue
Block a user