C

Qt Quick Ultralite swipegame Demo

/****************************************************************************** ** ** Copyright (C) 2021 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.0 import StyleModule 1.0 /* This view displays the initial start button and provides multiple swipe areas for navigation. */ BaseView { id: root signal swipeDownTriggered() signal swipeUpTriggered() signal swipeLeftTriggered() signal swipeRightTriggered() signal startRequested() Button { id: startButton anchors.centerIn: parent font: Style.textDefault.font text: "Start" onClicked: { root.startRequested() } } // area which catches downward swipes which start at the top of the view DirectionalSwipeArea { id: downArea anchors.fill: parent direction: DirectionalSwipeArea.Direction.Down onTriggered: { root.swipeDownTriggered() } } // area which catches upward swipes which start at the bottom of the view DirectionalSwipeArea { id: upArea anchors.fill: parent direction: DirectionalSwipeArea.Direction.Up onTriggered: { root.swipeUpTriggered() } } // area which catches leftward swipes which start at the right of the view DirectionalSwipeArea { id: leftArea anchors.fill: parent direction: DirectionalSwipeArea.Direction.Left onTriggered: { root.swipeLeftTriggered() } } // area which catches rightward swipes which start at the left of the view DirectionalSwipeArea { id: rightArea anchors.fill: parent direction: DirectionalSwipeArea.Direction.Right onTriggered: { root.swipeRightTriggered() } } }