summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraavit <eirik.aavitsland@digia.com>2014-03-04 14:56:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 05:50:18 +0100
commit83b3924cc38df57ff0be3114417faec7f97b021c (patch)
tree46306433630098c0e9b256da5d04a81ace0a48ba
parent3ff15f1e987e59b5c35224d7f2230905c4a5f3d0 (diff)
Fixes: style runtime warnings when painting too small widgets
Trying to create a 0-size cache image would lead to trying to paint to a null image, giving runtime warnings. Task-number: QTBUG-37035 Change-Id: I0a7fdb19cc7548dea2770d6be4eb283f6b898ada Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r--src/widgets/styles/qstyle_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index 70221f6d8f..9f25492173 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -96,8 +96,8 @@ inline QPixmap styleCachePixmap(const QSize &size)
QPainter *p = painter; \
QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = (txType <= QTransform::TxTranslate) \
- || (painter->deviceTransform().type() == QTransform::TxScale); \
+ bool doPixmapCache = (!option->rect.isEmpty()) \
+ && ((txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale)); \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \