Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QSTYLE_P_H
6
#
define
QSTYLE_P_H
7
8
#
include
"private/qobject_p.h"
9
#
include
<
QtWidgets
/
qstyle
.
h
>
10
11
QT_BEGIN_NAMESPACE
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
26
class
QStyle;
27
28
class
QStylePrivate
:
public
QObjectPrivate
29
{
30
Q_DECLARE_PUBLIC(QStyle)
31
public
:
32
static
QStylePrivate
*
get
(
QStyle
*
s
) {
return
s
?
s
->
d_func
() :
nullptr
; }
33
static
const
QStylePrivate
*
get
(
const
QStyle
*
s
) {
return
s
?
s
->
d_func
() :
nullptr
; }
34
35
static
bool
useFullScreenForPopup
();
36
37
QStyle *
proxyStyle
;
38
QString
name
;
39
};
40
41
inline
QPixmap
styleCachePixmap
(
const
QSize &size, qreal pixelRatio)
42
{
43
QPixmap cachePixmap = QPixmap(size * pixelRatio);
44
cachePixmap.setDevicePixelRatio(pixelRatio);
45
cachePixmap.fill(Qt::transparent);
46
return
cachePixmap;
47
}
48
49
// small helper to read out the pixmap to paint from QPixmapCache or re-draw
50
// it and put it into the QPixmapCache for later usage
51
class
Q_WIDGETS_EXPORT
QCachedPainter
52
{
53
public
:
54
QCachedPainter(QPainter *painter,
const
QString &cachePrefix,
55
const
QStyleOption *option, QSize size = {}, QRect paintRect = {});
56
~QCachedPainter();
57
void
finish();
58
bool
needsPainting()
const
59
{
60
return
!m_alreadyCached;
61
}
62
QRect pixmapRect()
const
63
{
64
const
auto
sz = m_pixmap.deviceIndependentSize();
65
return
QRect(0, 0, sz.width(), sz.height());
66
}
67
QPainter *operator->()
68
{
69
return
painter();
70
}
71
QPainter *painter()
72
{
73
Q_ASSERT_X(m_pixmapPainter,
"painter()"
,
"Must only be called when painting on a pixmap to cache"
);
74
return
m_pixmapPainter.get();
75
}
76
77
// clean pixmap cache from all cached pixmaps (e.g. due to palette change)
78
// to make sure the widgets are painted correctly afterwards
79
static
void
cleanupPixmapCache();
80
private
:
81
QPainter *m_painter =
nullptr
;
82
const
QStyleOption *m_option =
nullptr
;
83
std::unique_ptr<QPainter> m_pixmapPainter;
84
QString m_pixmapName;
85
QPixmap m_pixmap;
86
QRect m_paintRect;
87
bool
m_alreadyCached;
88
bool
m_pixmapDrawn =
false
;
89
static
QSet<QString> s_pixmapCacheKeys;
90
};
91
92
QT_END_NAMESPACE
93
94
#
endif
//QSTYLE_P_H
QCachedPainter
Definition
qstyle_p.h:52
QCommonStylePrivate
Definition
qcommonstyle_p.h:35
QCommonStyle
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
Definition
qcommonstyle.h:16
QPointF
\inmodule QtCore\reentrant
Definition
qpoint.h:232
QStylePrivate
Definition
qstyle_p.h:29
QStylePrivate::name
QString name
Definition
qstyle_p.h:38
QStylePrivate::proxyStyle
QStyle * proxyStyle
Definition
qstyle_p.h:37
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
viewItemTextLayout
static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight=-1, int *lastVisibleLine=nullptr)
Definition
qcommonstyle.cpp:810
qt_intensity
static uint qt_intensity(uint r, uint g, uint b)
Definition
qcommonstyle.cpp:6120
qCWarning
#define qCWarning(category,...)
Definition
qloggingcategory.h:164
Q_STATIC_LOGGING_CATEGORY
#define Q_STATIC_LOGGING_CATEGORY(name,...)
Definition
qloggingcategory.h:154
styleCachePixmap
QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)
Definition
qstyle_p.h:41
qtbase
src
widgets
styles
qstyle_p.h
Generated on
for Qt by
1.18.0