Main.qml 1.13 KB
import QtQuick
import QtQuick.Controls.Basic
import QtQuick.Layouts
import QtQuick.Window
import "." as App

ApplicationWindow {
    id: window
    visible: true
    width: 1280
    height: 880
    minimumWidth: 1100
    minimumHeight: 760
    title: appState.loggedIn
        ? "珠宝壹佰图像生成器"
        : "登录 - 珠宝壹佰图像生成器"
    color: App.Theme.bgCanvas

    // 登录前 400x460 小窗,登录后 1280x880 主窗口
    Component.onCompleted: updateGeometry()

    Connections {
        target: appState
        function onLoggedInChanged() {
            updateGeometry()
        }
    }

    function updateGeometry() {
        if (appState.loggedIn) {
            window.minimumWidth = 1100
            window.minimumHeight = 820
            window.width = 1280
            window.height = 940
        } else {
            window.minimumWidth = 360
            window.minimumHeight = 420
            window.width = 400
            window.height = 480
        }
    }

    StackLayout {
        anchors.fill: parent
        currentIndex: appState.loggedIn ? 1 : 0

        LoginScreen {}
        MainWindow {}
    }
}