* Plasma::Svg::resize() to use the default size of the SVG

* make the clock use that size

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=666807
This commit is contained in:
Aaron J. Seigo 2007-05-20 22:56:38 +00:00
parent f88f9ed076
commit cb2e8721a5
2 changed files with 16 additions and 1 deletions

10
svg.cpp
View File

@ -169,10 +169,18 @@ void Svg::resize( const QSizeF& size )
d->size = size;
}
void Svg::resize()
{
if (!d->renderer) {
d->renderer = new KSvgRenderer(Plasma::Theme::self()->image(d->themePath));
}
d->size = d->renderer->defaultSize();
}
QSize Svg::elementSize(const QString& elementId)
{
if (!d->renderer) {
return QSize();
d->renderer = new KSvgRenderer(Plasma::Theme::self()->image(d->themePath));
}
QSizeF elementSize = d->renderer->boundsOnElement(elementId).size();

7
svg.h
View File

@ -108,6 +108,13 @@ class PLASMA_EXPORT Svg : public QObject
**/
void resize( const QSizeF& size );
/**
* Resizes the rendered image to the natural size of the SVG.
* Rendering will actually take place on the next call to paint.
* @arg size the new size of the image
**/
void resize();
/**
* Size of a given element
* @arg elementId the id of the element to check