ContenPage添加NoteList组件

main
karlis 2023-07-06 14:00:55 +08:00
parent 1a4d662e73
commit 428ee6fafe
4 changed files with 113 additions and 27 deletions

View File

@ -0,0 +1,5 @@
import QtQuick
Item {
}

View File

@ -6,6 +6,46 @@ import "qrc:///AicsKnowledgeBase/qml/global"
Item { Item {
anchors.fill: parent anchors.fill: parent
signal open(string note) signal open(string note)
signal createNote
width: parent.width - 8
property ListModel noteListModel: ListModel {
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在确定父子组件之间同级组件之间的相对位置时非常常用若使用锚定方式确定子组件与父组件之间的位置关系使用 topbottomleftright topMarginbottomMarginleftMarginrightMargin进行上下左右对齐以及对齐后的留白距离。若要使子组件在父组件的水平垂直居中使用"
author: "超级无敌长的账户名"
pageView: 123
stars: 27
date: "2022-02-02"
}
ListElement {
uuid: "2"
title: "Qt布局"
brief: "锚定anchors在确定父子组件之间同级组件之间的相对位置时非常常用若使用锚定方式确定子组件与父组件之间的位置关系使用 topbottomleftright topMarginbottomMarginleftMarginrightMargin进行上下左右对齐以及对齐后的留白距离。若要使子组件在父组件的水平垂直居中使用"
author: "超级无敌长的账户名"
pageView: 123
stars: 27
date: "2022-02-02"
}
ListElement {
uuid: "2"
title: "Qt布局"
brief: "锚定anchors在确定父子组件之间同级组件之间的相对位置时非常常用若使用锚定方式确定子组件与父组件之间的位置关系使用 topbottomleftright topMarginbottomMarginleftMarginrightMargin进行上下左右对齐以及对齐后的留白距离。若要使子组件在父组件的水平垂直居中使用"
author: "超级无敌长的账户名"
pageView: 123
stars: 27
date: "2022-02-02"
}
}
ListView { ListView {
id: listView id: listView
anchors.fill: parent anchors.fill: parent
@ -18,11 +58,24 @@ Item {
id: noteListItemHeader id: noteListItemHeader
Item { Item {
id: noteListItemHeaderItem id: noteListItemHeaderItem
// width: ListView.view.width width: ListView.view.width
// height: 48 height: 48
// FluText { RowLayout {
// text: "" width: parent.width
// } FluText {
text: "笔记列表"
font.pixelSize: 18
font.bold: true
}
FluButton {
id: createNoteButton
text: "新建笔记"
Layout.alignment: Qt.AlignRight
onClicked: {
createNote()
}
}
}
} }
} }
Component { Component {
@ -54,25 +107,4 @@ Item {
function setListModel(listModel) { function setListModel(listModel) {
listView.model = 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在确定父子组件之间同级组件之间的相对位置时非常常用若使用锚定方式确定子组件与父组件之间的位置关系使用 topbottomleftright topMarginbottomMarginleftMarginrightMargin进行上下左右对齐以及对齐后的留白距离。若要使子组件在父组件的水平垂直居中使用"
author: "超级无敌长的账户名"
pageView: 123
stars: 27
date: "2022-02-02"
}
}
} }

View File

@ -8,8 +8,34 @@ import FluentUI
import AicsKB.FileTransferManager import AicsKB.FileTransferManager
import SignalFileOperation 1.0 import SignalFileOperation 1.0
import "qrc:///AicsKnowledgeBase/qml/page" import "qrc:///AicsKnowledgeBase/qml/page"
import "qrc:///AicsKnowledgeBase/qml/component"
FluArea { FluArea {
Popup {
id: popup
modal: true // true
focus: true //, activeFocus
padding: 0
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property var raiseItem: null
background: Rectangle {
color: Qt.rgba(0, 0, 0, 0) //
}
FluArea {
width: 350
height: 500
backgroundColor: "#f9f9f9"
NoteList {
id: noteList
onOpen: function handle(noteId) {
console.log("open note: " + noteId)
}
onCreateNote: function handle() {
console.log("create note")
}
}
}
}
id: content_area id: content_area
paddings: 0 paddings: 0
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
@ -76,6 +102,28 @@ FluArea {
bold: true bold: true
} }
} }
ColumnLayout {
id: layout_note
FluIconButton {
id: button_note
iconSize: 15
iconSource: FluentIcons.QuickNote
text: "笔记"
onClicked: {
popup.open()
}
}
FluText {
text: ""
font.pointSize: 8
Layout.alignment: button_note.Center
Layout.topMargin: -5
}
anchors {
verticalCenter: text_title.verticalCenter
right: parent.right
}
}
ColumnLayout { ColumnLayout {
id: layout_share id: layout_share
FluIconButton { FluIconButton {
@ -93,7 +141,7 @@ FluArea {
} }
anchors { anchors {
verticalCenter: text_title.verticalCenter verticalCenter: text_title.verticalCenter
right: parent.right right: layout_note.left
} }
} }
ColumnLayout { ColumnLayout {
@ -157,6 +205,7 @@ FluArea {
implicitHeight: 100 implicitHeight: 100
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
width: parent.width
FluText { FluText {
padding: 10 padding: 10
text: content_page.publishTime.toDateString() text: content_page.publishTime.toDateString()

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB