From b329ddb69a5d1a1f30bc408b87a9b0978b485b7d Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 31 Aug 2007 15:15:04 +0000 Subject: [PATCH] Fix elementSize() , elementRect() always returning 0 in Plasma::Svg if called before resize(). Set the size to the document's default size when the renderer is created. Makes it possible to determine the aspect ratio of the graphic. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=706931 --- svg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/svg.cpp b/svg.cpp index 8fab1ef40..82739ac7c 100644 --- a/svg.cpp +++ b/svg.cpp @@ -159,6 +159,8 @@ class Svg::Private renderer = new SharedSvgRenderer(path); renderers[path] = renderer; } + + size = renderer->defaultSize(); } QSize elementSize(const QString& elementId) @@ -245,13 +247,13 @@ void Svg::resize( int width, int height ) void Svg::resize( const QSizeF& size ) { + d->createRenderer(); d->size = size; } void Svg::resize() { d->createRenderer(); - d->size = d->renderer->defaultSize(); } QSize Svg::elementSize(const QString& elementId) const