blob: 355c02f0cd985633e61bc6c9cf89c870b1b2864a (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
Rectangle {
id: root
property color rectColor: "red"
Rectangle {
property int d: 100
id: square
width: d
height: d
anchors.centerIn: parent
color: root.rectColor
NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; }
}
Text {
id: text
anchors.centerIn: parent
property string api
Connections {
target: text.GraphicsInfo
function onApiChanged() {
var api = text.GraphicsInfo.api;
if (api === GraphicsInfo.Software)
text.api = "Software";
else if (api === GraphicsInfo.OpenGL)
text.api = "OpenGL on QRhi";
else if (api === GraphicsInfo.Direct3D11)
text.api = "D3D11 on QRhi";
else if (api === GraphicsInfo.Vulkan)
text.api = "Vulkan on QRhi";
else if (api === GraphicsInfo.Metal)
text.api = "Metal on QRhi";
else if (api === GraphicsInfo.Null)
text.api = "Null on QRhi";
else
text.api = "Unknown API";
}
}
text: "Qt Quick running in a widget\nGraphicsInfo.api says: " + api
}
function performLayerBasedGrab(fn) {
root.grabToImage(function(result) {
result.saveToFile(fn);
});
}
}
|