From 60ae1cf7e91fe4db90c94fc9408bbefbd49b3d05 Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Sun, 2 Jul 2023 22:39:30 +0800 Subject: [PATCH 1/4] NoteList --- .../qml/component/{NoteItem.qml => NoteListItem.qml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename AicsKnowledgeBase/qml/component/{NoteItem.qml => NoteListItem.qml} (100%) diff --git a/AicsKnowledgeBase/qml/component/NoteItem.qml b/AicsKnowledgeBase/qml/component/NoteListItem.qml similarity index 100% rename from AicsKnowledgeBase/qml/component/NoteItem.qml rename to AicsKnowledgeBase/qml/component/NoteListItem.qml From fef9e1503021d2c624fffedd59395a5a61713278 Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Sun, 2 Jul 2023 22:39:39 +0800 Subject: [PATCH 2/4] NoteList --- AicsKnowledgeBase/qml/component/NoteList.qml | 78 +++++++++++++++++ .../qml/component/NoteListItem.qml | 87 ++++++++----------- 2 files changed, 113 insertions(+), 52 deletions(-) create mode 100644 AicsKnowledgeBase/qml/component/NoteList.qml diff --git a/AicsKnowledgeBase/qml/component/NoteList.qml b/AicsKnowledgeBase/qml/component/NoteList.qml new file mode 100644 index 0000000..c5010c1 --- /dev/null +++ b/AicsKnowledgeBase/qml/component/NoteList.qml @@ -0,0 +1,78 @@ +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" + } + } +} diff --git a/AicsKnowledgeBase/qml/component/NoteListItem.qml b/AicsKnowledgeBase/qml/component/NoteListItem.qml index 94ffc06..9eaba75 100644 --- a/AicsKnowledgeBase/qml/component/NoteListItem.qml +++ b/AicsKnowledgeBase/qml/component/NoteListItem.qml @@ -3,75 +3,58 @@ import FluentUI import QtQuick.Layouts FluArea { - id: fileItem + id: noteItem 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) + property string author 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() - } + RowLayout { + id: titleRow + Layout.preferredWidth: parent.width + FluText { + text: title + font.bold: true + font.pointSize: 15 + Layout.alignment: Qt.AlignLeft } 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 + "收藏" - } + text: author + Layout.alignment: Qt.AlignRight } } + FluText { + text: " " + brief + Layout.fillWidth: true + wrapMode: Text.WrapAnywhere + elide: Text.ElideRight + maximumLineCount: 3 + } 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) - } - } + 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 } } } From b2c40f9e843bc78f4898f48db66b7b1fa09d7341 Mon Sep 17 00:00:00 2001 From: shmily744 <1527550984@qq.com> Date: Mon, 3 Jul 2023 10:38:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?search=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/page/SearchPage.qml | 112 +++++++++++++++++++++- 1 file changed, 108 insertions(+), 4 deletions(-) diff --git a/AicsKnowledgeBase/qml/page/SearchPage.qml b/AicsKnowledgeBase/qml/page/SearchPage.qml index 9117b62..6593db9 100644 --- a/AicsKnowledgeBase/qml/page/SearchPage.qml +++ b/AicsKnowledgeBase/qml/page/SearchPage.qml @@ -4,6 +4,7 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Basic import FluentUI +import "qrc:///AicsKnowledgeBase/qml/component" FluArea { property string url: '' @@ -13,8 +14,111 @@ FluArea { Layout.topMargin: 20 paddings: 10 - FluText { - Layout.topMargin: 20 - text: "Search" - } +// FluText { +// Layout.topMargin: 20 +// text: "Search" +// } + /* + 按标题,内容搜索 + */ + ColumnLayout{ + + RowLayout{ + width:parent.width + FluDropDownButton{ + id:select_model + Layout.alignment: Qt.AlignLeft + text:"标题" + items:[ + FluMenuItem{ + text:"标题" + onClicked: { + select_model.text = text + } + }, + FluMenuItem{ + text:"内容" + onClicked: { + select_model.text = text + } + }, + FluMenuItem{ + text:"标签" + onClicked: { + select_model.text = text + } + } + ] + } + + FluTextBox{ + //placeholderText:"" + Layout.fillWidth: true + + + } + FluIconButton{ + Layout.alignment: Qt.AlignRight + iconSource:FluentIcons.Search + } + } + //按文件类型 + RowLayout{ + width:parent.width + FluText{ + Layout.alignment: Qt.AlignLeft + text:"格式: " + } + FluCheckBox{ + id:selectAllFormat + text:"all" + Component.onCompleted:{ + clicked() + } + onClicked:{ + selectPDFAndWord.checked=true + selectVideo.checked=true + selectPPT.checked=true + } + } + FluCheckBox{ + id:selectPDFAndWord + text:"pdf/word" + //wrapMode: Text.WordWrap + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } + FluCheckBox{ + id:selectPPT + text:"ppt" + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } + + FluCheckBox{ + id:selectVideo + text:"video" + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } + } + + + Rectangle{ + FileList{ + Button{ + anchors.fill: parent + background: Rectangle{ + color: Qt.red + } + } + // anchors.top: tags.anchors.bottom + // anchors.bottom: parent.anchors.bottom + } + } + + } } From 9ea3b2c30bfa47c1fd494ecba4db9dc43f8f0eba Mon Sep 17 00:00:00 2001 From: shmily744 <1527550984@qq.com> Date: Mon, 3 Jul 2023 16:12:26 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86serach=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8C=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A=E4=BA=86?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E7=94=A8=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/component/FileList.qml | 56 +++--- AicsKnowledgeBase/qml/page/SearchPage.qml | 185 +++++++++---------- 2 files changed, 116 insertions(+), 125 deletions(-) diff --git a/AicsKnowledgeBase/qml/component/FileList.qml b/AicsKnowledgeBase/qml/component/FileList.qml index 72e2165..642a41b 100644 --- a/AicsKnowledgeBase/qml/component/FileList.qml +++ b/AicsKnowledgeBase/qml/component/FileList.qml @@ -156,33 +156,33 @@ Item { } ListModel { id: fileListModel - // ListElement { - // title: "File 1" - // isDir: true - // brief: "This is a test file" - // type: "FOLDER" - // } - // ListElement { - // uid: "2" - // title: "File 2" - // isDir: false - // brief: "This is a test file" - // size: 500 - // type: "WORD" - // date: "2020-09-09" - // pageView: 100 - // stars: 10 - // } - // ListElement { - // uid: "3" - // title: "File 3" - // isDir: false - // brief: "This is a test file" - // type: "PPT" - // date: "2020-09-09" - // pageView: 100 - // size: 10200000022 - // stars: 10 - // } + ListElement { + title: "File 1" + isDir: true + brief: "This is a test file" + type: "FOLDER" + } + ListElement { + uid: "2" + title: "File 2" + isDir: false + brief: "This is a test file" + size: 500 + type: "WORD" + date: "2020-09-09" + pageView: 100 + stars: 10 + } + ListElement { + uid: "3" + title: "File 3" + isDir: false + brief: "This is a test file" + type: "PPT" + date: "2020-09-09" + pageView: 100 + size: 10200000022 + stars: 10 + } } } diff --git a/AicsKnowledgeBase/qml/page/SearchPage.qml b/AicsKnowledgeBase/qml/page/SearchPage.qml index 6593db9..df66917 100644 --- a/AicsKnowledgeBase/qml/page/SearchPage.qml +++ b/AicsKnowledgeBase/qml/page/SearchPage.qml @@ -14,111 +14,102 @@ FluArea { Layout.topMargin: 20 paddings: 10 -// FluText { -// Layout.topMargin: 20 -// text: "Search" -// } + // FluText { + // Layout.topMargin: 20 + // text: "Search" + // } /* 按标题,内容搜索 */ - ColumnLayout{ + ColumnLayout{ + RowLayout{ + width:parent.width + FluDropDownButton{ + id:select_model + Layout.alignment: Qt.AlignLeft + text:"标题" + items:[ + FluMenuItem{ + text:"标题" + onClicked: { + select_model.text = text + } + }, + FluMenuItem{ + text:"内容" + onClicked: { + select_model.text = text + } + }, + FluMenuItem{ + text:"标签" + onClicked: { + select_model.text = text + } + } + ] + } - RowLayout{ - width:parent.width - FluDropDownButton{ - id:select_model - Layout.alignment: Qt.AlignLeft - text:"标题" - items:[ - FluMenuItem{ - text:"标题" - onClicked: { - select_model.text = text - } - }, - FluMenuItem{ - text:"内容" - onClicked: { - select_model.text = text - } - }, - FluMenuItem{ - text:"标签" - onClicked: { - select_model.text = text - } - } - ] - } - - FluTextBox{ - //placeholderText:"" - Layout.fillWidth: true + FluTextBox{ + //placeholderText:"" + Layout.fillWidth: true - } - FluIconButton{ - Layout.alignment: Qt.AlignRight - iconSource:FluentIcons.Search - } - } - //按文件类型 - RowLayout{ - width:parent.width - FluText{ - Layout.alignment: Qt.AlignLeft - text:"格式: " - } - FluCheckBox{ - id:selectAllFormat - text:"all" - Component.onCompleted:{ - clicked() - } - onClicked:{ - selectPDFAndWord.checked=true - selectVideo.checked=true - selectPPT.checked=true - } - } - FluCheckBox{ - id:selectPDFAndWord - text:"pdf/word" - //wrapMode: Text.WordWrap - onClicked:{ - selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked - } - } - FluCheckBox{ - id:selectPPT - text:"ppt" - onClicked:{ - selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked - } - } + } + FluIconButton{ + Layout.alignment: Qt.AlignRight + iconSource:FluentIcons.Search + } + } + //按文件类型 + RowLayout{ + width:parent.width + FluText{ + Layout.alignment: Qt.AlignLeft + text:"格式: " + } + FluCheckBox{ + id:selectAllFormat + text:"all" + Component.onCompleted:{ + clicked() + } + onClicked:{ + selectPDFAndWord.checked=true + selectVideo.checked=true + selectPPT.checked=true + } + } + FluCheckBox{ + id:selectPDFAndWord + text:"pdf/word" + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } + FluCheckBox{ + id:selectPPT + text:"ppt" + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } - FluCheckBox{ - id:selectVideo - text:"video" - onClicked:{ - selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked - } - } - } + FluCheckBox{ + id:selectVideo + text:"video" + onClicked:{ + selectAllFormat.checked = selectPDFAndWord.checked && selectPPT.checked && selectVideo.checked + } + } + } - Rectangle{ - FileList{ - Button{ - anchors.fill: parent - background: Rectangle{ - color: Qt.red - } - } - // anchors.top: tags.anchors.bottom - // anchors.bottom: parent.anchors.bottom - } - } + Rectangle{ + FileList{ - } + } + } + + } }