* 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
This commit is contained in:
Aaron J. Seigo 2007-07-31 01:11:25 +00:00
parent 999cd6ed57
commit 8d4debed10

View File

@ -96,6 +96,8 @@ public:
void init(Applet* applet) void init(Applet* applet)
{ {
applet->setFlag(QGraphicsItem::ItemClipsToShape, false);
applet->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
kioskImmutable = applet->globalConfig().isImmutable() || kioskImmutable = applet->globalConfig().isImmutable() ||
applet->config().isImmutable(); applet->config().isImmutable();
applet->setImmutable(kioskImmutable); applet->setImmutable(kioskImmutable);
@ -164,12 +166,6 @@ public:
QSize contents = contentSize(q).toSize(); QSize contents = contentSize(q).toSize();
const int contentWidth = contents.width(); const int contentWidth = contents.width();
const int contentHeight = contents.height(); 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(); background->resize();
@ -189,7 +185,6 @@ public:
const int bottomOffset = contentHeight; const int bottomOffset = contentHeight;
const int contentTop = 0; const int contentTop = 0;
const int contentLeft = 0; const int contentLeft = 0;
if (!cachedBackground || cachedBackground->size() != QSize(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight)) { if (!cachedBackground || cachedBackground->size() != QSize(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight)) {
delete cachedBackground; delete cachedBackground;
cachedBackground = new QPixmap(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight); cachedBackground = new QPixmap(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight);
@ -449,13 +444,8 @@ bool Applet::isImmutable() const
void Applet::setImmutable(bool immutable) void Applet::setImmutable(bool immutable)
{ {
d->immutable = immutable; d->immutable = immutable;
QGraphicsItem::GraphicsItemFlags f = flags(); setFlag(QGraphicsItem::ItemIsMovable, d->immutable || d->kioskImmutable ||
if (immutable) { !scene() || !static_cast<Corona*>(scene())->isImmutable());
f ^= QGraphicsItem::ItemIsMovable;
} else if (!d->kioskImmutable && (!scene() || !static_cast<Corona*>(scene())->isImmutable())) {
f |= QGraphicsItem::ItemIsMovable;
}
setFlags(f);
} }
bool Applet::drawStandardBackground() bool Applet::drawStandardBackground()
@ -528,7 +518,7 @@ int Applet::type() const
return Type; return Type;
} }
QRectF Applet::boundingRect () const QRectF Applet::boundingRect() const
{ {
QRectF rect = QRectF(QPointF(0,0), d->contentSize(this)); QRectF rect = QRectF(QPointF(0,0), d->contentSize(this));
if (!d->background) { if (!d->background) {
@ -542,7 +532,6 @@ QRectF Applet::boundingRect () const
rect.adjust(0 - leftWidth, 0 - topHeight, rightWidth, bottomHeight); rect.adjust(0 - leftWidth, 0 - topHeight, rightWidth, bottomHeight);
return rect; return rect;
} }
QList<QAction*> Applet::contextActions() QList<QAction*> Applet::contextActions()
@ -659,7 +648,7 @@ QString Applet::globalName() const
QString Applet::instanceName() const QString Applet::instanceName() const
{ {
d->instanceName(); return d->instanceName();
} }
void Applet::watchForFocus(QObject *widget, bool watch) void Applet::watchForFocus(QObject *widget, bool watch)