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
qquickpixmapcache_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 QQUICKPIXMAPCACHE_H
5
#define QQUICKPIXMAPCACHE_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#include <QtCore/qmutex.h>
19
#include <QtCore/qurl.h>
20
#include <QtQuick/qquickimageprovider.h>
21
#include <private/qquickpixmap_p.h>
22
23
QT_BEGIN_NAMESPACE
24
25
class
QQuickPixmapData
;
26
30
struct
Q_AUTOTEST_EXPORT
QQuickPixmapKey
31
{
32
const
QUrl
*
url
;
33
const
QRect
*
region
;
34
const
QSize
*
size
;
35
int
frame
;
36
QQuickImageProviderOptions
options
;
37
};
38
44
class
Q_AUTOTEST_EXPORT
QQuickPixmapCache
:
public
QObject
45
{
46
Q_OBJECT
47
48
public
:
49
static
QQuickPixmapCache
*instance();
50
~QQuickPixmapCache
()
override
;
51
52
void
unreferencePixmap(
QQuickPixmapData
*);
53
void
referencePixmap(
QQuickPixmapData
*);
54
55
void
purgeCache();
56
57
protected
:
58
void
timerEvent(
QTimerEvent
*)
override
;
59
60
private
:
61
QQuickPixmapCache
() =
default
;
62
Q_DISABLE_COPY(
QQuickPixmapCache
)
63
64
void
shrinkCache(
int
remove
);
65
int
destroyCache();
66
qsizetype
referencedCost()
const
;
67
68
private
:
69
QHash<QQuickPixmapKey, QQuickPixmapData *> m_cache;
70
mutable
QMutex
m_cacheMutex;
// avoid simultaneous iteration and modification
71
72
QQuickPixmapData
*m_unreferencedPixmaps =
nullptr
;
73
QQuickPixmapData
*m_lastUnreferencedPixmap =
nullptr
;
74
75
int
m_unreferencedCost = 0;
76
int
m_timerId = -1;
77
bool
m_destroying =
false
;
78
79
friend
class
QQuickPixmap
;
80
friend
class
QQuickPixmapData
;
81
friend
class
tst_qquickpixmapcache;
82
friend
class
tst_qquicktext;
83
friend
class
tst_qquicktextedit;
84
};
85
86
QT_END_NAMESPACE
87
88
#endif
// QQUICKPIXMAPCACHE_H
QMutex
\inmodule QtCore
Definition
qmutex.h:281
QObject
\inmodule QtCore
Definition
qobject.h:103
QQuickImageProviderOptions
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
Definition
qquickpixmap_p.h:58
QQuickPixmapCache
Definition
qquickpixmapcache_p.h:45
QQuickPixmapData
Definition
qquickpixmapcache.cpp:304
QQuickPixmap
Definition
qquickpixmap_p.h:104
QRect
\inmodule QtCore\reentrant
Definition
qrect.h:30
QSize
\inmodule QtCore
Definition
qsize.h:25
QTimerEvent
\inmodule QtCore
Definition
qcoreevent.h:366
QUrl
\inmodule QtCore
Definition
qurl.h:94
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
Q_AUTOTEST_EXPORT
#define Q_AUTOTEST_EXPORT
Definition
qtconfigmacros.h:56
Q_OBJECT
#define Q_OBJECT
Definition
qtmetamacros.h:119
qsizetype
ptrdiff_t qsizetype
Definition
qtypes.h:165
remove
settings remove("monkey")
QQuickPixmapKey
Definition
qquickpixmapcache_p.h:31
QQuickPixmapKey::options
QQuickImageProviderOptions options
Definition
qquickpixmapcache_p.h:36
QQuickPixmapKey::size
const QSize * size
Definition
qquickpixmapcache_p.h:34
QQuickPixmapKey::frame
int frame
Definition
qquickpixmapcache_p.h:35
QQuickPixmapKey::url
const QUrl * url
Definition
qquickpixmapcache_p.h:32
QQuickPixmapKey::region
const QRect * region
Definition
qquickpixmapcache_p.h:33
qtdeclarative
src
quick
util
qquickpixmapcache_p.h
Generated by
1.10.0