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>
This commit is contained in:
aavit 2014-03-04 14:56:04 +01:00 committed by The Qt Project
parent 3ff15f1e98
commit 83b3924cc3

View File

@ -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 { \