1// Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
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 QQUICKITEMGRABRESULT_H
5#define QQUICKITEMGRABRESULT_H
6
7#include <QtCore/QObject>
8#include <QtCore/QSize>
9#include <QtCore/QUrl>
10#include <QtGui/QImage>
11#include <QtQml/QJSValue>
12#include <QtQml/qqml.h>
13#include <QtQuick/qtquickglobal.h>
14
15QT_BEGIN_NAMESPACE
16
17class QImage;
18
19class QQuickItemGrabResultPrivate;
20
21class Q_QUICK_EXPORT QQuickItemGrabResult : public QObject
22{
23 Q_OBJECT
24 Q_DECLARE_PRIVATE(QQuickItemGrabResult)
25
26 Q_PROPERTY(QImage image READ image CONSTANT FINAL)
27 Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
28 QML_ANONYMOUS
29 QML_ADDED_IN_VERSION(2, 0)
30
31public:
32 QImage image() const;
33 QUrl url() const;
34
35#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
36#if QT_DEPRECATED_SINCE(5, 15)
37 QT_DEPRECATED_X("This overload is deprecated. Use the const member function instead")
38 Q_INVOKABLE bool saveToFile(const QString &fileName);
39#endif
40#endif
41 Q_INVOKABLE bool saveToFile(const QString &fileName) const;
42 Q_REVISION(6, 2) Q_INVOKABLE bool saveToFile(const QUrl &fileName) const;
43
44protected:
45 bool event(QEvent *) override;
46
47Q_SIGNALS:
48 void ready();
49
50private Q_SLOTS:
51 void setup();
52 void render();
53
54private:
55 friend class QQuickItem;
56
57 QQuickItemGrabResult(QObject *parent = nullptr);
58};
59
60QT_END_NAMESPACE
61
62#endif
63

source code of qtdeclarative/src/quick/items/qquickitemgrabresult.h