67 lines
1.6 KiB
QML
67 lines
1.6 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Window
|
|
import QtQuick.Layouts
|
|
import FluentUI
|
|
|
|
Popup {
|
|
id: transfer_popup
|
|
x: parent ? (parent.width - implicitWidth) / 2 : 0
|
|
y: parent ? parent.height : 0
|
|
background: FluArea {
|
|
implicitWidth: 300
|
|
implicitHeight: 200
|
|
color: "#f8f8f8"
|
|
radius: 5
|
|
FluShadow {}
|
|
}
|
|
|
|
contentItem: Item {
|
|
anchors.top: parent.top
|
|
|
|
ListModel //模型-提供数据
|
|
{
|
|
id: itemModel
|
|
ListElement {
|
|
name: "Apple"
|
|
progressValue: 0.1
|
|
}
|
|
ListElement {
|
|
name: "Orange"
|
|
progressValue: 1
|
|
}
|
|
ListElement {
|
|
name: "Banana"
|
|
progressValue: 0.6
|
|
}
|
|
}
|
|
|
|
Component //委托-提供一个展示数据的示例(如何展示一个模型中的数据)
|
|
{
|
|
id: itemDelegate
|
|
|
|
ColumnLayout {
|
|
spacing: 10
|
|
width: parent.width
|
|
Text {
|
|
Layout.topMargin: 10
|
|
text: name
|
|
}
|
|
|
|
FluProgressBar {
|
|
Layout.fillWidth: true
|
|
progress: progressValue
|
|
indeterminate: false
|
|
}
|
|
}
|
|
}
|
|
|
|
ListView //视图-设置委托和模型,根据委托提供的展示方式展示模型提供的数据
|
|
{
|
|
anchors.fill: parent
|
|
model: itemModel
|
|
delegate: itemDelegate
|
|
}
|
|
}
|
|
}
|