From 94517b3f8799a61c3cba8ece08b843810bdb8226 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 3 May 2008 17:30:37 +0000 Subject: [PATCH] a little more deterministic behaviour: Svg::elementSize(elementId) returns 0,0 for not existing elements: this fixes also some of the panel funny behaviour svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=803651 --- svg.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/svg.cpp b/svg.cpp index a2d1896db..1c9d84643 100644 --- a/svg.cpp +++ b/svg.cpp @@ -219,6 +219,11 @@ class Svg::Private QSize elementSize(const QString& elementId) { createRenderer(); + + if (!renderer->elementExists(elementId)) { + return QSize(0, 0); + } + QSizeF elementSize = renderer->boundsOnElement(elementId).size(); QSizeF naturalSize = renderer->defaultSize(); qreal dx = size.width() / naturalSize.width();