diff --git a/plugins/pathshapes/enhancedpath/EnhancedPathShape.cpp b/plugins/pathshapes/enhancedpath/EnhancedPathShape.cpp --- a/plugins/pathshapes/enhancedpath/EnhancedPathShape.cpp +++ b/plugins/pathshapes/enhancedpath/EnhancedPathShape.cpp @@ -449,8 +449,10 @@ // save the right size so that when loading we fit the viewbox // to the right size without getting any wrong scaling // -> calculate the right size from the current size/viewbound ratio - context.xmlWriter().addAttributePt("svg:width", currentSize.width() == 0 ? 0 : m_viewBox.width()*currentSize.width()/m_viewBound.width()); - context.xmlWriter().addAttributePt("svg:height", currentSize.height() == 0 ? 0 : m_viewBox.height()*currentSize.height()/m_viewBound.height()); + const QSizeF contentSize = currentSize.boundedTo(m_viewBox.size()); + const QSizeF scaledSize = currentSize.scaled(contentSize, Qt::KeepAspectRatio); + context.xmlWriter().addAttributePt("svg:width", scaledSize.width()); + context.xmlWriter().addAttributePt("svg:height", scaledSize.height()); saveText(context);