Compare commits
No commits in common. "fef9e1503021d2c624fffedd59395a5a61713278" and "9c5d8115cb38184fc04355ed64c91c1032234948" have entirely different histories.
fef9e15030
...
9c5d8115cb
|
@ -0,0 +1,78 @@
|
|||
import QtQuick 2.15
|
||||
import FluentUI
|
||||
import QtQuick.Layouts
|
||||
|
||||
FluArea {
|
||||
id: fileItem
|
||||
property string uuid
|
||||
property string title
|
||||
property string brief
|
||||
property string date
|
||||
property int pageView
|
||||
property var tags: []
|
||||
property var notes: []
|
||||
property int stars
|
||||
property var colorList: ["blue", "green", "orange", "red", "yellow", "purple", "pink", "brown", "teal", "cyan", "gray", "darkgray"]
|
||||
signal tagClicked(string tag)
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: 10
|
||||
|
||||
ColumnLayout {
|
||||
id: clickable
|
||||
anchors.fill: parent
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
fileItem.parent.doubleClicked()
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
id: title
|
||||
text: fileItem.title
|
||||
font{
|
||||
pointSize: 12
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
id: brief
|
||||
text: fileItem.brief
|
||||
}
|
||||
RowLayout {
|
||||
id: infoRow
|
||||
visible: !fileItem.isDir
|
||||
FluText {
|
||||
id: date
|
||||
text: fileItem.date
|
||||
}
|
||||
FluText {
|
||||
id: pageView
|
||||
text: fileItem.pageView + "浏览"
|
||||
}
|
||||
FluText {
|
||||
id: stars
|
||||
text: fileItem.stars + "收藏"
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
visible: !fileItem.isDir
|
||||
Repeater {
|
||||
model: fileItem.tags
|
||||
delegate: FluTextButton {
|
||||
text: "#" + fileItem.tags[index]
|
||||
normalColor: colorList[index % colorList.length]
|
||||
font.pixelSize: 12
|
||||
Layout.preferredWidth: 50
|
||||
onClicked: {
|
||||
emit: tagClicked(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///AicsKnowledgeBase/qml/global"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
signal open(string note)
|
||||
ListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
header: noteListItemHeader
|
||||
model: noteListModel
|
||||
delegate: noteListItemDelegate
|
||||
}
|
||||
Component {
|
||||
id: noteListItemHeader
|
||||
Item {
|
||||
id: noteListItemHeaderItem
|
||||
// width: ListView.view.width
|
||||
// height: 48
|
||||
// FluText {
|
||||
// text: "笔记"
|
||||
// }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: noteListItemDelegate
|
||||
Rectangle {
|
||||
id: noteListItemRect
|
||||
width: ListView.view.width
|
||||
height: 150
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
open(model.uuid)
|
||||
}
|
||||
}
|
||||
NoteListItem {
|
||||
id: noteListItem
|
||||
uuid: model.uuid
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
title: model.title
|
||||
date: model.date
|
||||
brief: model.brief
|
||||
pageView: model.pageView
|
||||
author: model.author
|
||||
stars: model.stars
|
||||
}
|
||||
}
|
||||
}
|
||||
function setListModel(listModel) {
|
||||
listView.model = listModel
|
||||
}
|
||||
ListModel {
|
||||
id: noteListModel
|
||||
ListElement {
|
||||
uuid: "1"
|
||||
title: "超级无敌报错"
|
||||
brief: "file:///D:/academic/2023-qtBig/AicsKnowledgeBase_client/AicsKnowledgeBase/qml/component/NoteList.qml:41:21: Unable to assign [undefined] to QString"
|
||||
author: "admin"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
}
|
||||
ListElement {
|
||||
uuid: "2"
|
||||
title: "Qt布局"
|
||||
brief: "锚定(anchors)在确定父子组件之间,同级组件之间的相对位置时非常常用,若使用锚定方式确定子组件与父组件之间的位置关系,使用 top,bottom,left,right, topMargin,bottomMargin,leftMargin,rightMargin进行上下左右对齐,以及对齐后的留白距离。若要使子组件在父组件的水平,垂直居中,使用:"
|
||||
author: "超级无敌长的账户名"
|
||||
pageView: 123
|
||||
stars: 27
|
||||
date: "2022-02-02"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
import QtQuick 2.15
|
||||
import FluentUI
|
||||
import QtQuick.Layouts
|
||||
|
||||
FluArea {
|
||||
id: noteItem
|
||||
property string uuid
|
||||
property string title
|
||||
property string brief
|
||||
property string date
|
||||
property int pageView
|
||||
property int stars
|
||||
property string author
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: 10
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
Layout.preferredWidth: parent.width
|
||||
FluText {
|
||||
text: title
|
||||
font.bold: true
|
||||
font.pointSize: 15
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
FluText {
|
||||
text: author
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
FluText {
|
||||
text: " " + brief
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WrapAnywhere
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 3
|
||||
}
|
||||
RowLayout {
|
||||
id: bottomRow
|
||||
Layout.preferredWidth: parent.width
|
||||
FluText {
|
||||
text: date
|
||||
color: "#5F5F5F"
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
FluText {
|
||||
text: pageView + " 浏览"
|
||||
color: "#5F5F5F"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText {
|
||||
text: stars + " 收藏"
|
||||
color: "#5F5F5F"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue