C
Qt Quick Ultralite 层示例
/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/import QtQuick 2.15 import QtQuickUltralite.Layers 2.0 ItemLayer { id: itemLayer property int colorDepth: 32 property real t: 0 depth: (colorDepth === 32) ? ItemLayer.Bpp32 : ItemLayer.Bpp16Alpha NumberAnimation on t { running: true loops: Animation.Infinite from: 0 to: 1 duration: 4000 } Rectangle { anchors.fill: parent color: "white" Rectangle { id: textBox anchors.top: parent.top width: parent.width height: parent.height * 2 / 3 Column { id: textColumn anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.margins: parent.height / 16 Text { text: colorDepth + " bpp item layer" font.pixelSize: 18 anchors.horizontalCenter: parent.horizontalCenter } Text { text: "Refresh interval: " + itemLayer.refreshInterval font.pixelSize: 18 anchors.horizontalCenter: parent.horizontalCenter } } } Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: textBox.bottom anchors.margins: parent.height / 16 opacity: 0.8 source: "qt-logo.png" } Rectangle { property int redBoxWidth: parent.height / 16 width: redBoxWidth height: redBoxWidth anchors.bottom: parent.bottom x: -redBoxWidth + t * (parent.width + redBoxWidth) color: "red" } } }