8#include "private/qobject_p.h"
9#include <QtWidgets/qstyle.h>
30 Q_DECLARE_PUBLIC(QStyle)
43 QPixmap cachePixmap = QPixmap(size * pixelRatio);
44 cachePixmap.setDevicePixelRatio(pixelRatio);
45 cachePixmap.fill(Qt::transparent);
54 QCachedPainter(QPainter *painter,
const QString &cachePrefix,
55 const QStyleOption *option, QSize size = {}, QRect paintRect = {});
58 bool needsPainting()
const
60 return !m_alreadyCached;
62 QRect pixmapRect()
const
64 const auto sz = m_pixmap.deviceIndependentSize();
65 return QRect(0, 0, sz.width(), sz.height());
67 QPainter *operator->()
73 Q_ASSERT_X(m_pixmapPainter,
"painter()",
"Must only be called when painting on a pixmap to cache");
74 return m_pixmapPainter.get();
79 static void cleanupPixmapCache();
81 QPainter *m_painter =
nullptr;
82 const QStyleOption *m_option =
nullptr;
83 std::unique_ptr<QPainter> m_pixmapPainter;
88 bool m_pixmapDrawn =
false;
89 static QSet<QString> s_pixmapCacheKeys;
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
\inmodule QtCore\reentrant
static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight=-1, int *lastVisibleLine=nullptr)
static uint qt_intensity(uint r, uint g, uint b)
#define qCWarning(category,...)
#define Q_STATIC_LOGGING_CATEGORY(name,...)
QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)