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 <KDebug>
#include <plasma/theme.h>
namespace Plasma namespace Plasma
{ {
@ -88,6 +90,7 @@ public:
void generateBackground(PanelData *panel); void generateBackground(PanelData *panel);
void updateSizes(); void updateSizes();
void updateNeeded();
void updateAndSignalSizes(); void updateAndSignalSizes();
Location location; Location location;
@ -104,7 +107,7 @@ PanelSvg::PanelSvg(QObject* parent)
: Svg(parent), : Svg(parent),
d(new Private(this)) d(new Private(this))
{ {
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateSizes())); connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded()));
d->panels.insert(QString(), new PanelData()); d->panels.insert(QString(), new PanelData());
} }
@ -602,9 +605,15 @@ void PanelSvg::Private::updateSizes()
panel->stretchBorders = q->hasElement("hint-stretch-borders"); panel->stretchBorders = q->hasElement("hint-stretch-borders");
} }
void PanelSvg::Private::updateNeeded()
{
q->clearCache();
updateSizes();
}
void PanelSvg::Private::updateAndSignalSizes() void PanelSvg::Private::updateAndSignalSizes()
{ {
// updateSizes(); <-- this gets called when repaintNeeded is emitted updateSizes();
emit q->repaintNeeded(); 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_INVOKABLE void paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos = QPointF(0, 0));
Q_SIGNALS:
void repaintNeeded();
private: private:
class Private; class Private;
Private * const d; Private * const d;
Q_PRIVATE_SLOT(d, void updateSizes()) Q_PRIVATE_SLOT(d, void updateSizes())
Q_PRIVATE_SLOT(d, void updateNeeded())
}; };
} // Plasma namespace } // Plasma namespace