AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/FileListItem.qml

70 lines
1.7 KiB
QML
Raw Normal View History

2023-06-24 18:02:21 +08:00
import QtQuick 2.15
import FluentUI
import QtQuick.Layouts
Item {
id: fileItem
property string id
property string title
property string brief
property string date
property string type
property string suffix
property bool isDir: false
property int size
property int pageView
property var tags: []
property var notes: []
property int stars
ColumnLayout {
id: row
anchors.fill: parent
anchors.margins: 10
spacing: 10
RowLayout {
Image {
id: icon
source: type ?
"qrc:/AicsKnowledgeBase/res/" + type + ".png" : ""
Layout.preferredHeight: 18
Layout.preferredWidth: 18
}
FluText {
id: title
text: fileItem.title
}
}
FluText {
id: brief
visible: !fileItem.isDir
text: fileItem.brief
}
RowLayout {
visible: !fileItem.isDir
FluText {
id: date
text: fileItem.date
}
FluText {
id: size
// cast Byte size to right text size
text: fileItem.size > 1024
* 1024 ? (fileItem.size / 1024 / 1024).toFixed(
2) + "MB" : (fileItem.size / 1024).toFixed(
2) + "KB"
}
FluText {
id: pageView
text: fileItem.pageView + "浏览"
}
FluText {
id: stars
text: fileItem.stars + "收藏"
}
}
}
}