From 8970a02211b31fd8e1fb6a0059deddfc2cb5a7e5 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 24 Jul 2007 19:27:58 +0000 Subject: [PATCH] catch when paintInterface is mis-implemented, draw -something- and spit out a warning on the console svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=691980 --- applet.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/applet.cpp b/applet.cpp index 04ea16e5c..c38f69fbd 100644 --- a/applet.cpp +++ b/applet.cpp @@ -126,6 +126,12 @@ public: applet->config().isImmutable()); } + void paintBackground(QPainter* painter, Applet* q) + { + background->resize(q->boundingRect().size()); + background->paint(painter, q->boundingRect()); + } + static uint nextId() { ++s_maxAppletId; @@ -379,8 +385,7 @@ QRectF Applet::boundingRect () const void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { if (d->background) { - d->background->resize(boundingRect().size()); - d->background->paint(painter, boundingRect()); + d->paintBackground(painter, this); } if (d->failed) { @@ -398,6 +403,11 @@ void Applet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *o if (d->scriptEngine) { d->scriptEngine->paintInterface(painter, option); + } else if (!d->background) { + // we should not be in here, the child applet probably screwed up + setDrawStandardBackground(true); + kDebug() << "Applet::paintInterface ... we should not be in here. check your painInterface method" << endl; + d->paintBackground(painter, this); } }