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
24
26
38
45{
47
48public:
49 static QQuickPixmapCache *instance();
50 ~QQuickPixmapCache() override;
51
52 void unreferencePixmap(QQuickPixmapData *);
53 void referencePixmap(QQuickPixmapData *);
54
55 void purgeCache();
56
57protected:
58 void timerEvent(QTimerEvent *) override;
59
60private:
61 QQuickPixmapCache() = default;
62 Q_DISABLE_COPY(QQuickPixmapCache)
63
64 void shrinkCache(int remove);
65 int destroyCache();
66 qsizetype referencedCost() const;
67
68private:
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
87
88#endif // QQUICKPIXMAPCACHE_H
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
\inmodule QtCore
Definition qcoreevent.h:366
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
#define Q_AUTOTEST_EXPORT
#define Q_OBJECT
ptrdiff_t qsizetype
Definition qtypes.h:165
settings remove("monkey")
QQuickImageProviderOptions options