Improved drag&drop: the top level window now gets masked :)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=806660
This commit is contained in:
Rob Scheepmaker 2008-05-11 23:56:32 +00:00
parent 143b126bca
commit 8d75ba14c2

View File

@ -20,6 +20,7 @@
#include "applethandle_p.h"
#include <QApplication>
#include <QBitmap>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <QtGui/QLinearGradient>
#include <QtGui/QPainter>
@ -465,6 +466,24 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
kDebug() << "scaling topview with: " << scale;
m_topview->scale(scale, scale);
//Paint a mask based on the applets shape.
//TODO: might be useful to have this in applet?
QBitmap bitmap(m_applet->screenRect().size());
QPainter * shapePainter = new QPainter();
shapePainter->begin(&bitmap);
shapePainter->fillRect(0, 0, m_applet->screenRect().width(),
m_applet->screenRect().height(),
Qt::white);
shapePainter->setBrush(Qt::black);
shapePainter->drawPath(m_applet->shape());
shapePainter->end();
delete shapePainter;
m_topview->setMask(bitmap);
m_topview->show();
m_applet->setGhostView(m_applet->containment()->view());