Item {
id: textPopupId
width: implicitWidth // 设置 Item 的宽度为 implicitWidth 属性的值
height: implicitHeight // 设置 Item 的高度为 implicitHeight 属性的值
property int bgType: 0
property alias bgImage: bgImage.source
Image {
id: bgImage
fillMode: Image.PreserveAspectFit
visible: true
source: textPopupId.bgType === 0 ? ":/images_mr/popup/popupBackground/popupBg0.png"
: textPopupId.bgType === 1 ? "qrc:/images_mr/popup/popupBackground/popupBg1.png"
: textPopupId.bgType === 2 ? "qrc:/images_mr/popup/popupBackground/popupBg2.png"
: textPopupId.bgType === 3 ? "qrc:/images_mr/popup/popupBackground/popupBg3.png"
: "qrc:/images_mr/popup/popupBackground/popupBg1.png"
}
}
qml Item能够动态地选择图片来源
最新推荐文章于 2024-07-11 16:34:43 发布