summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/designercore/imagecache/imagecacheconnectionmanager.h
blob: 276916b4a12be8b166c33e872ea4f3f0cd2b0eab (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
30
31
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <designercore/instances/connectionmanager.h>

namespace QmlDesigner {

class CapturedDataCommand;

class ImageCacheConnectionManager : public ConnectionManager
{
public:
    using Callback = std::function<void(const QImage &)>;

    ImageCacheConnectionManager();

    void setCallback(Callback captureCallback);

    bool waitForCapturedData();

protected:
    void dispatchCommand(const QVariant &command, Connection &connection) override;

private:
    Callback m_captureCallback;
    bool m_capturedDataArrived = false;
};

} // namespace QmlDesigner