aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/imagecache/explicitimagecacheimageprovider.h
blob: a1e2c19d2d61933fa77c33f7eb842ac43603d0b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QQuickAsyncImageProvider>
#include <QQuickImageResponse>

namespace QmlDesigner {

class AsynchronousExplicitImageCache;

class ExplicitImageCacheImageProvider : public QQuickAsyncImageProvider
{
public:
    ExplicitImageCacheImageProvider(AsynchronousExplicitImageCache &imageCache,
                                    const QImage &defaultImage)
        : m_cache(imageCache)
        , m_defaultImage(defaultImage)
    {}

    QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;

private:
    AsynchronousExplicitImageCache &m_cache;
    QImage m_defaultImage;
};

} // namespace QmlDesigner