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 QQuickItemGrabResultPrivate;
18
19class Q_QUICK_EXPORT QQuickItemGrabResult : public QObject
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(QQuickItemGrabResult)
23
24 Q_PROPERTY(QImage image READ image CONSTANT)
25 Q_PROPERTY(QUrl url READ url CONSTANT)
26 QML_ANONYMOUS
27 QML_ADDED_IN_VERSION(2, 0)
28
29public:
30 QImage image() const;
31 QUrl url() const;
32
33#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
34#if QT_DEPRECATED_SINCE(5, 15)
35 QT_DEPRECATED_X("This overload is deprecated. Use the const member function instead")
36 Q_INVOKABLE bool saveToFile(const QString &fileName);
37#endif
38#endif
39 Q_INVOKABLE bool saveToFile(const QString &fileName) const;
40 Q_REVISION(6, 2) Q_INVOKABLE bool saveToFile(const QUrl &fileName) const;
41
42protected:
43 bool event(QEvent *) override;
44
45Q_SIGNALS:
46 void ready();
47
48private Q_SLOTS:
49 void setup();
50 void render();
51
52private:
53 friend class QQuickItem;
54
55 QQuickItemGrabResult(QObject *parent = nullptr);
56};
57
58QT_END_NAMESPACE
59
60#endif
61

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