summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorSergio Martins <iamsergio@gmail.com>2018-02-25 19:14:10 +0000
committerSérgio Martins <sergio.martins@kdab.com>2018-09-16 13:26:24 +0000
commit2a9cdd88b027cdd7304d0abff17299688551ba81 (patch)
treef43e38087d40f0e76f742ae659cd063df0fa5e41 /src/widgets/styles/qstylesheetstyle.cpp
parent50315cc56e8cd89aedfdaa00ca6fb21f246c6540 (diff)
stylesheets: Don't fail silently with invalid background-images
Print a qWarning, otherwise this is very hard to notice Change-Id: I882f97583071e786d5aa06f6eeb485da4fc646db Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/widgets/styles/qstylesheetstyle.cpp')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index e34bae64ce..5c9d19a49d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -44,6 +44,7 @@
#include "private/qcssutil_p.h"
#include <qdebug.h>
+#include <qdir.h>
#include <qapplication.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -952,8 +953,12 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
Attachment attachment = Attachment_Scroll;
origin = Origin_Padding;
Origin clip = Origin_Border;
- if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip))
- bg = new QStyleSheetBackgroundData(brush, QPixmap(uri), repeat, alignment, origin, attachment, clip);
+ if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip)) {
+ QPixmap pixmap(uri);
+ if (!uri.isEmpty() && pixmap.isNull())
+ qWarning("Could not create pixmap from %s", qPrintable(QDir::toNativeSeparators(uri)));
+ bg = new QStyleSheetBackgroundData(brush, pixmap, repeat, alignment, origin, attachment, clip);
+ }
QBrush sfg, fg;
QBrush sbg, abg;