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
This commit is contained in:
Marco Martin 2008-05-03 17:30:37 +00:00
parent c3925a3496
commit 94517b3f87

View File

@ -219,6 +219,11 @@ class Svg::Private
QSize elementSize(const QString& elementId) QSize elementSize(const QString& elementId)
{ {
createRenderer(); createRenderer();
if (!renderer->elementExists(elementId)) {
return QSize(0, 0);
}
QSizeF elementSize = renderer->boundsOnElement(elementId).size(); QSizeF elementSize = renderer->boundsOnElement(elementId).size();
QSizeF naturalSize = renderer->defaultSize(); QSizeF naturalSize = renderer->defaultSize();
qreal dx = size.width() / naturalSize.width(); qreal dx = size.width() / naturalSize.width();