import QtQuick 2.15 Rectangle { id: root width: 800 height: 1280 color: "white" Image { id: backgroundImage anchors.fill: parent source: "qrc:/123.png" fillMode: Image.PreserveAspectFit smooth: true Component.onCompleted: { console.log("QML: 图片加载中...") } onStatusChanged: { if (status === Image.Error) { console.log("QML: 图片加载失败") placeholderText.visible = true } else if (status === Image.Ready) { console.log("QML: 图片加载成功") } } } Text { id: placeholderText anchors.centerIn: parent text: "背景图片加载失败" color: "red" font.pixelSize: 24 visible: false } Text { anchors.centerIn: parent text: "QML 界面已显示" font.pixelSize: 40 color: "blue" visible: false } Component.onCompleted: { console.log("QML: 界面初始化完成") placeholderText.visible = true } }