Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstyle_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSTYLE_P_H
5#define QSTYLE_P_H
6
7#include "private/qobject_p.h"
8#include <QtGui/qguiapplication.h>
9#include <QtWidgets/qstyle.h>
10
12
13//
14// W A R N I N G
15// -------------
16//
17// This file is not part of the Qt API. It exists for the convenience
18// of qstyle_*.cpp. This header file may change from version to version
19// without notice, or even be removed.
20//
21// We mean it.
22//
23
24// Private class
25
26class QStyle;
27
29{
30 Q_DECLARE_PUBLIC(QStyle)
31public:
32 static bool useFullScreenForPopup();
33
36};
37
38inline QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)
39{
40 QPixmap cachePixmap = QPixmap(size * pixelRatio);
41 cachePixmap.setDevicePixelRatio(pixelRatio);
42 cachePixmap.fill(Qt::transparent);
43 return cachePixmap;
44}
45
46#define BEGIN_STYLE_PIXMAPCACHE(a) \
47 QRect rect = option->rect; \
48 QPixmap internalPixmapCache; \
49 QPainter *p = painter; \
50 const auto dpr = p->device()->devicePixelRatio(); \
51 const QString unique = QStyleHelper::uniqueName((a), option, option->rect.size(), dpr); \
52 int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
53 const bool doPixmapCache = (!option->rect.isEmpty()) \
54 && ((txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale)); \
55 if (doPixmapCache && QPixmapCache::find(unique, &internalPixmapCache)) { \
56 painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
57 } else { \
58 if (doPixmapCache) { \
59 rect.setRect(0, 0, option->rect.width(), option->rect.height()); \
60 internalPixmapCache = styleCachePixmap(option->rect.size(), dpr); \
61 p = new QPainter(&internalPixmapCache); \
62 }
63
64
65
66#define END_STYLE_PIXMAPCACHE \
67 if (doPixmapCache) { \
68 p->end(); \
69 delete p; \
70 painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
71 QPixmapCache::insert(unique, internalPixmapCache); \
72 } \
73 }
74
76
77#endif //QSTYLE_P_H
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString name
Definition qstyle_p.h:35
QStyle * proxyStyle
Definition qstyle_p.h:34
static bool useFullScreenForPopup()
Definition qstyle.cpp:2420
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
Definition qstyle.h:29
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
GLenum GLuint GLintptr GLsizeiptr size
[1]
QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)
Definition qstyle_p.h:38
double qreal
Definition qtypes.h:187