修改NoteList

main
karlis 2023-07-07 05:45:29 +08:00
parent 542867f4f3
commit a65e4af382
2 changed files with 59 additions and 55 deletions

View File

@ -1,5 +1,7 @@
import QtQuick 2.15
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Window
import FluentUI
import "qrc:///AicsKnowledgeBase/qml/global"
@ -50,23 +52,13 @@ Item {
date: "2022-02-02"
}
}
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
RowLayout {
width: parent.width
height: 48
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 10
anchors.rightMargin: 10
FluText {
text: "笔记列表"
font.pixelSize: 18
@ -81,13 +73,19 @@ Item {
}
}
}
}
}
Component {
id: noteListItemDelegate
Rectangle {
FluScrollablePage {
anchors.fill: parent
anchors.topMargin: 50
ColumnLayout {
Layout.fillWidth: true
spacing: 8
Repeater {
id: repeater
model: noteListModel
delegate: Rectangle {
id: noteListItemRect
width: ListView.view.width
Layout.fillWidth: true
height: 150
MouseArea {
anchors.fill: parent
@ -110,8 +108,11 @@ Item {
}
}
}
}
}
function setListModel(listModel) {
listView.model = listModel
repeater.model = listModel
//console.log(listView.model.get(0).uuid)
}
}

View File

@ -14,6 +14,8 @@ import "qrc:///AicsKnowledgeBase/qml/global"
FluArea {
property ListModel noteListModel2: ListModel {}
Popup {
x: parent.width - width
implicitHeight: parent.height
id: popup
modal: true // true
focus: true //, activeFocus
@ -24,12 +26,13 @@ FluArea {
color: Qt.rgba(0, 0, 0, 0) //
}
FluArea {
width: 350
height: 500
backgroundColor: "#f9f9f9"
NoteList {
id: noteList
noteListModel: noteListModel2
//noteListModel: noteListModel2
onOpen: function handle(noteId, authorId) {
emit: SignalFileOperation.openNote(noteId, authorId)
popup.close()