mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-03 16:45:24 +08:00
update
This commit is contained in:
42
src/imports/FluentUI/Controls/FluImage.qml
Normal file
42
src/imports/FluentUI/Controls/FluImage.qml
Normal file
@ -0,0 +1,42 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
property url source
|
||||
property string errorButtonText: "重新加载"
|
||||
property var status
|
||||
property var clickErrorListener : function(){
|
||||
image.source = ""
|
||||
image.source = control.source
|
||||
}
|
||||
id: control
|
||||
Image{
|
||||
id:image
|
||||
anchors.fill: parent
|
||||
source: control.source
|
||||
opacity: control.status === Image.Ready
|
||||
onStatusChanged:{
|
||||
control.status = image.status
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation{
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||
FluProgressRing{
|
||||
anchors.centerIn: parent
|
||||
visible: control.status === Image.Loading
|
||||
}
|
||||
FluFilledButton{
|
||||
text: control.errorButtonText
|
||||
anchors.centerIn: parent
|
||||
visible: control.status === Image.Error
|
||||
onClicked: clickErrorListener()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user