panelPixmap() to retrieve the cached rendered panel (and render if it's

not in the cache)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=866437
This commit is contained in:
Marco Martin 2008-09-30 20:47:47 +00:00
parent 5f51803436
commit 53c1c1cdbe
2 changed files with 20 additions and 0 deletions

View File

@ -371,6 +371,17 @@ void PanelSvg::clearCache()
}
}
QPixmap PanelSvg::panelPixmap()
{
PanelData *panel = d->panels[d->prefix];
if (!panel->cachedBackground) {
d->generateBackground(panel);
Q_ASSERT(panel->cachedBackground);
}
return *panel->cachedBackground;
}
void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF& source)
{
PanelData *panel = d->panels[d->prefix];

View File

@ -223,6 +223,15 @@ class PLASMA_EXPORT PanelSvg : public Svg
*/
void clearCache();
/**
* Returns a pixmap of the SVG represented by this object.
*
* @arg elelementId the ID string of the element to render, or an empty
* string for the whole SVG (the default)
* @return a QPixmap of the rendered SVG
*/
Q_INVOKABLE QPixmap panelPixmap();
/**
* Paints the loaded SVG with the elements that represents the border
* @arg painter the QPainter to use