update the svg painting and margins calculations when the theme changes

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=812089
This commit is contained in:
Marco Martin 2008-05-24 15:33:35 +00:00
parent a2fb80dd0e
commit d01cb72c4d
2 changed files with 12 additions and 5 deletions

View File

@ -26,6 +26,8 @@
#include <KDebug>
#include <plasma/theme.h>
namespace Plasma
{
@ -88,6 +90,7 @@ public:
void generateBackground(PanelData *panel);
void updateSizes();
void updateNeeded();
void updateAndSignalSizes();
Location location;
@ -104,7 +107,7 @@ PanelSvg::PanelSvg(QObject* parent)
: Svg(parent),
d(new Private(this))
{
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateSizes()));
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded()));
d->panels.insert(QString(), new PanelData());
}
@ -602,9 +605,15 @@ void PanelSvg::Private::updateSizes()
panel->stretchBorders = q->hasElement("hint-stretch-borders");
}
void PanelSvg::Private::updateNeeded()
{
q->clearCache();
updateSizes();
}
void PanelSvg::Private::updateAndSignalSizes()
{
// updateSizes(); <-- this gets called when repaintNeeded is emitted
updateSizes();
emit q->repaintNeeded();
}

View File

@ -193,14 +193,12 @@ class PLASMA_EXPORT PanelSvg : public Svg
*/
Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos = QPointF(0, 0));
Q_SIGNALS:
void repaintNeeded();
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void updateSizes())
Q_PRIVATE_SLOT(d, void updateNeeded())
};
} // Plasma namespace