summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyle_p.h
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2012-09-21 19:53:28 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-18 21:46:21 +0200
commitf45afd71551a6cd1553952ea003e9356651809b5 (patch)
treec2fb59e5811f636ea43d0a53f126213c2a5b76e1 /src/widgets/styles/qstyle_p.h
parent8b6de4677142cab41790ca50ce6c7f1efbab5de8 (diff)
Introduce new style Fusion
This is a new non-native style for Qt. It is intended as a replacement for the now aging Plastique and Cleanlooks styles. Change-Id: I30c0518a69e4e3b8b2b05ee7d84c3a5a1f307578 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/widgets/styles/qstyle_p.h')
-rw-r--r--src/widgets/styles/qstyle_p.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index 66cd7eed10..85e8e54b16 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -72,6 +72,15 @@ public:
QStyle *proxyStyle;
};
+inline QImage styleCacheImage(const QSize &size)
+{
+ return QImage(size, QImage::Format_ARGB32_Premultiplied);
+}
+
+inline QPixmap styleCachePixmap(const QSize &size)
+{
+ return QPixmap(size);
+}
#define BEGIN_STYLE_PIXMAPCACHE(a) \
QRect rect = option->rect; \
@@ -80,13 +89,14 @@ public:
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; \
+ bool doPixmapCache = (txType <= QTransform::TxTranslate) \
+ || (painter->deviceTransform().type() == QTransform::TxScale); \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
if (doPixmapCache) { \
rect.setRect(0, 0, option->rect.width(), option->rect.height()); \
- imageCache = QImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); \
+ imageCache = styleCacheImage(option->rect.size()); \
imageCache.fill(0); \
p = new QPainter(&imageCache); \
}