From 8d4debed1092aba3a799b1d37054100719476fcc Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 31 Jul 2007 01:11:25 +0000 Subject: [PATCH] * add missing return in instanceName * turn off clipping to shape for Applet as that breaks background painting in cute and wonderful ways * remove some dead code * use setFlag instead of setFlags everywhere svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=694556 --- applet.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/applet.cpp b/applet.cpp index 9864aa5a0..a297c98e3 100644 --- a/applet.cpp +++ b/applet.cpp @@ -96,6 +96,8 @@ public: void init(Applet* applet) { + applet->setFlag(QGraphicsItem::ItemClipsToShape, false); + applet->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); kioskImmutable = applet->globalConfig().isImmutable() || applet->config().isImmutable(); applet->setImmutable(kioskImmutable); @@ -164,12 +166,6 @@ public: QSize contents = contentSize(q).toSize(); const int contentWidth = contents.width(); const int contentHeight = contents.height(); -#if 0 - // this could be used to draw a dynamic shadow - QImage image(w, h, QImage::Format_ARGB32_Premultiplied); - QPainter* p = new QPainter(&image); - p->setCompositionMode(QPainter::CompositionMode_Source); -#endif background->resize(); @@ -189,7 +185,6 @@ public: const int bottomOffset = contentHeight; const int contentTop = 0; const int contentLeft = 0; - if (!cachedBackground || cachedBackground->size() != QSize(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight)) { delete cachedBackground; cachedBackground = new QPixmap(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight); @@ -449,13 +444,8 @@ bool Applet::isImmutable() const void Applet::setImmutable(bool immutable) { d->immutable = immutable; - QGraphicsItem::GraphicsItemFlags f = flags(); - if (immutable) { - f ^= QGraphicsItem::ItemIsMovable; - } else if (!d->kioskImmutable && (!scene() || !static_cast(scene())->isImmutable())) { - f |= QGraphicsItem::ItemIsMovable; - } - setFlags(f); + setFlag(QGraphicsItem::ItemIsMovable, d->immutable || d->kioskImmutable || + !scene() || !static_cast(scene())->isImmutable()); } bool Applet::drawStandardBackground() @@ -528,7 +518,7 @@ int Applet::type() const return Type; } -QRectF Applet::boundingRect () const +QRectF Applet::boundingRect() const { QRectF rect = QRectF(QPointF(0,0), d->contentSize(this)); if (!d->background) { @@ -542,7 +532,6 @@ QRectF Applet::boundingRect () const rect.adjust(0 - leftWidth, 0 - topHeight, rightWidth, bottomHeight); return rect; - } QList Applet::contextActions() @@ -659,7 +648,7 @@ QString Applet::globalName() const QString Applet::instanceName() const { - d->instanceName(); + return d->instanceName(); } void Applet::watchForFocus(QObject *widget, bool watch)