公民
Qt Quick Ultralite 加载器示例
/****************************************************************************** ** ** Copyright (C) 2022 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 SettingsData import GameState Rectangle { id: root color: SettingsData.backgroundColor readonly property int numberOfPages: 2 property int currentPage: -1 Loader { id: mainView anchors.fill: parent source: "Logo.qml" Connections { target: root function onCurrentPageChanged(currentPage: int) { if (currentPage === 0) { mainView.source = "memory_game/MemoryGame.qml" } else if (currentPage === 1) { mainView.source = "settings/Settings.qml" GameState.running = false } } } } PageButton { id: prevButton anchors.left: root.left height: root.height width: root.width / 10 visible: root.currentPage != -1 icon: "images/previous_page.png" onClicked: { if(--currentPage < 0) { currentPage = numberOfPages-1 } } } PageButton { id: nextButton anchors.right: root.right height: root.height width: root.width / 10 visible: root.currentPage != -1 icon: "images/next_page.png" onClicked: { currentPage = (++currentPage)%(numberOfPages) } } MouseArea { anchors.fill: parent enabled: root.currentPage == -1 onClicked: { root.currentPage = 0 } } }