diff options
Diffstat (limited to 'examples/quick/quickwidgets/quickwidget/rotatingsquare.qml')
-rw-r--r-- | examples/quick/quickwidgets/quickwidget/rotatingsquare.qml | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml index 5d3bb72fbe..08b769d80f 100644 --- a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml +++ b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml @@ -48,10 +48,11 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.8 Rectangle { id: root + property color rectColor: "red" Rectangle { property int d: 100 @@ -59,13 +60,35 @@ Rectangle { width: d height: d anchors.centerIn: parent - color: "red" + color: root.rectColor NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } } Text { + id: text anchors.centerIn: parent - text: "Qt Quick running in a widget" + 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) { |