* 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:
parent
f88f9ed076
commit
cb2e8721a5
10
svg.cpp
10
svg.cpp
@ -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
7
svg.h
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user