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 game's starting value and provides a switch to change the game mode. It will start the game automatically if the mode wasn't changes for specific amount of time. */ BaseView { id: root signal gameStarted() onVisibleChanged: { if (visible) { delayTimer.restart() } else { delayTimer.stop() } } Text { id: userHint anchors { top: parent.top topMargin: Style.marginDefault horizontalCenter: parent.horizontalCenter } font: Style.textSmall.font color: Style.colorLightText text: "longpress to stop" } Text { id: questionText anchors { top: userHint.bottom topMargin: Style.marginDefault horizontalCenter: parent.horizontalCenter } font: Style.textDefault.font color: Style.colorText text: "Start Value" } Text { id: startValue anchors.centerIn: parent font: Globals.useNumberMode ? Style.textBig.font : Style.textDefault.font color: Style.colorText text: Globals.useNumberMode ? Globals.gameStartNumber : Globals.gameStartCountry } LabeledSwitch { id: modeSwitch anchors { bottom: parent.bottom bottomMargin: Style.marginBig horizontalCenter: parent.horizontalCenter } text: "Mode" font: Style.textSmall.font checked: Globals.useNumberMode onTriggered: { Globals.switchGameMode() delayTimer.restart() } } Timer { id: delayTimer interval: Style.gameStartDelay onTriggered: { Globals.requestNewValue() root.gameStarted() } } }