C

Qt Quick Ultralite layers Example

/****************************************************************************** ** ** 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 Application { Screen { id: screen width: 800 height: 480 property bool vertical: height > width property int boxWidth: screen.width * 43 / 100 property int boxHeight: (vertical ? screen.height : Math.min(screen.height, background.height)) * 40 / 100 property int marginWidth: screen.width * 4 / 100 AnimatingItemLayer { id: bpp32layer z: 2 width: screen.boxWidth height: screen.boxHeight anchors.top: spriteLayer16bpp.top anchors.right: spriteLayer16bpp.right anchors.margins: screen.marginWidth renderingHints: ItemLayer.OptimizeForSize refreshInterval: 4 colorDepth: 32 opacity: 0.6 } SpriteLayer { id: spriteLayer32bpp z: 4 opacity: 0.6 anchors.fill: spriteLayer16bpp AnimatingItemLayer { z: 2 renderingHints: ItemLayer.OptimizeForSpeed width: screen.boxWidth height: screen.boxHeight anchors.top: parent.top anchors.left: parent.left anchors.margins: screen.marginWidth colorDepth: 32 refreshInterval: 2 } Repeater { model: 6 MovingImageLayer { z: 1 container: spriteLayer32bpp source: "qt-logo.png" } } } SpriteLayer { id: spriteLayer16bpp z: 0 width: screen.vertical ? parent.width : background.width height: screen.vertical ? parent.height : background.height anchors.centerIn: parent depth: ItemLayer.Bpp16 ImageLayer { id: background z: 0 anchors.centerIn: parent source: "background-big.png" } AnimatingItemLayer { z: 1 renderingHints: ItemLayer.OptimizeForSpeed width: screen.boxWidth height: screen.boxHeight anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: screen.marginWidth colorDepth: 16 depth: ItemLayer.Bpp16 } } AnimatingItemLayer { depth: ItemLayer.Bpp16Alpha z: 1 width: screen.boxWidth height: screen.boxHeight anchors.right: spriteLayer16bpp.right anchors.bottom: spriteLayer16bpp.bottom anchors.margins: screen.marginWidth colorDepth: 16 opacity: 0.6 } } }