diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-03-02 13:17:04 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-03-02 14:51:41 +0000 |
commit | ac4dcc585f4fb02b9b04867c75a883e4ad23693e (patch) | |
tree | 4b65a37b431843c6964b6c40148a8d93eb1cdd7f | |
parent | 726eaaeeeede086ed341899b8ee0c1570e6bf6f5 (diff) |
Avoid assert in rich text when img width is invalid
If you set the width or height of an <img> tag to something
invalid, this will be registered as -2 by the HTML parser.
We should treat this case the same as if there is no width/height
specified and use the implicit size instead.
[ChangeLog][Text] Fixed assert when setting an invalid width or
height on an <img> tag in a text element.
Change-Id: Iae8c33fa184316632f72318e71f26ab005645a21
Task-number: QTBUG-44743
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r-- | src/quick/items/qquicktext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 9311b9d9c9..1919ba9e79 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -144,10 +144,10 @@ QSizeF QQuickTextDocumentWithImageResources::intrinsicSize( if (format.isImageFormat()) { QTextImageFormat imageFormat = format.toImageFormat(); - const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth); const int width = qRound(imageFormat.width()); - const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight); + const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth) && width > 0; const int height = qRound(imageFormat.height()); + const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight) && height > 0; QSizeF size(width, height); if (!hasWidth || !hasHeight) { |