From 83b3924cc38df57ff0be3114417faec7f97b021c Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 4 Mar 2014 14:56:04 +0100 Subject: 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 --- src/widgets/styles/qstyle_p.h | 4 ++-- 1 file 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 { \ -- cgit v1.2.3