summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/qsvghandler.cpp')
-rw-r--r--src/svg/qsvghandler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 3b5bd0d..5e07181 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1740,14 +1740,13 @@ static void parseOpacity(QSvgNode *node,
const QSvgAttributes &attributes,
QSvgHandler *)
{
- QString value = attributes.value(QLatin1String("opacity")).toString();
- value = value.trimmed();
+ const QString value = attributes.value(QLatin1String("opacity")).toString().trimmed();
bool ok = false;
- qreal op = value.toDouble(&ok);
+ qreal op = value.toReal(&ok);
if (ok) {
- QSvgOpacityStyle *opacity = new QSvgOpacityStyle(qMin(qreal(1.0), qMax(qreal(0.0), op)));
+ QSvgOpacityStyle *opacity = new QSvgOpacityStyle(qBound(qreal(0.0), op, qreal(1.0)));
node->appendStyleProperty(opacity, someId(attributes));
}
}