kill that ugly white border when dragging the extender and compositing

is active (need a custom view for that, sigh)

svn path=/trunk/KDE/kdelibs/; revision=901786
This commit is contained in:
Marco Martin 2008-12-26 16:41:53 +00:00
parent 1acc45799a
commit dc76999e7e

View File

@ -53,6 +53,33 @@
namespace Plasma namespace Plasma
{ {
class ExtenderItemView : public QGraphicsView
{
public:
ExtenderItemView(QGraphicsScene *scene, QWidget *parent = 0)
: QGraphicsView(scene, parent)
{
//since this view witll have a really short lifespan it can be checked a single time
composite = KWindowSystem::compositingActive();
}
~ExtenderItemView()
{}
void drawBackground(QPainter *painter, const QRectF &rect)
{
if (composite) {
painter->setCompositionMode(QPainter::CompositionMode_Source);
painter->fillRect(rect.toAlignedRect(), Qt::transparent);
} else {
QGraphicsView::drawBackground(painter, rect);
}
}
private:
bool composite;
};
ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId) ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId)
: QGraphicsWidget(hostExtender), : QGraphicsWidget(hostExtender),
d(new ExtenderItemPrivate(this, hostExtender)) d(new ExtenderItemPrivate(this, hostExtender))
@ -556,7 +583,7 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
//create a toplevel view and aim it at the applet. //create a toplevel view and aim it at the applet.
corona->addOffscreenWidget(this); corona->addOffscreenWidget(this);
d->toplevel = new QGraphicsView(scene(), 0); d->toplevel = new ExtenderItemView(scene(), 0);
d->toplevel->setWindowFlags( d->toplevel->setWindowFlags(
Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);