From f70066e95e7e23562155686cb7d7874b2d5da5a1 Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Tue, 20 Dec 2016 16:45:20 -0800 Subject: Make it possible to call grabToImage() on Window.contentItem Window.contentItem was not associated with any QQmlContext and QQmlEngine. A valid pointer to QQmlEngine is needed for callback function execution. Task-number: QTBUG-57175 Change-Id: Iab7730bfc8860521ff2e8c1631a11d0e1fe0cf94 Reviewed-by: Shawn Rutledge --- .../quick/qquickwindow/data/grabContentItemToImage.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml (limited to 'tests/auto/quick/qquickwindow/data') diff --git a/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml new file mode 100644 index 0000000000..9086e0cc84 --- /dev/null +++ b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QtQuick.Window 2.2 as Window + +Window.Window { + visible: true + width: 100 + height: 100 + property int success: 0 + + function grabContentItemToImage() { + contentItem.grabToImage(function (image) { + success = 1 + }) + } +} -- cgit v1.2.3