make it possible for the wallpaper to accept mouse clicks, thereby getting mouse moves

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=856723
This commit is contained in:
Aaron J. Seigo 2008-09-03 16:46:01 +00:00
parent 35bfe20877
commit 02c5028f8c
2 changed files with 21 additions and 6 deletions

View File

@ -356,6 +356,7 @@ Corona* Containment::corona() const
void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
event->ignore();
if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos());
if (item == this) {
@ -363,11 +364,15 @@ void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
if (!event->isAccepted()) {
event->accept();
Applet::mouseMoveEvent(event);
}
}
void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
event->ignore();
if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos());
if (item == this) {
@ -375,11 +380,15 @@ void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
if (!event->isAccepted()) {
event->accept();
Applet::mousePressEvent(event);
}
}
void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
event->ignore();
if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos());
if (item == this) {
@ -387,8 +396,11 @@ void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
if (!event->isAccepted()) {
event->accept();
Applet::mouseReleaseEvent(event);
}
}
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
{

View File

@ -163,21 +163,24 @@ class PLASMA_EXPORT Wallpaper : public QObject
virtual QWidget *createConfigurationInterface(QWidget *parent);
/**
* Mouse move event
* Mouse move event. To prevent further propagation of the event,
* the event must be accepted.
*
* @param event the mouse event object
*/
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
/**
* Mouse press event
* Mouse press event. To prevent further propagation of the even,
* and to receive mouseMoveEvents, the event must be accepted.
*
* @param event the mouse event object
*/
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
/**
* Mouse release event
* Mouse release event. To prevent further propagation of the event,
* the event must be accepted.
*
* @param event the mouse event object
*/