添加了内容界面信号

main
yang.yongquan 2023-07-05 20:04:43 +08:00
parent 7be44d40b1
commit 7bdddec934
4 changed files with 21 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/global"
import SignalFileOperation 1.0
Item { Item {
anchors.fill: parent anchors.fill: parent
@ -163,7 +164,7 @@ Item {
if (model.isDir) { if (model.isDir) {
listView.headerItem.add(model.title, model.uuid) listView.headerItem.add(model.title, model.uuid)
} else { } else {
emit: open(model.uuid) emit: SignalFileOperation.open(model.uuid)
} }
} }
} }

View File

@ -0,0 +1,8 @@
pragma Singleton
import QtQuick
QtObject {
signal open(string file)
signal openNote(string note)
}

View File

@ -6,12 +6,14 @@ import QtQuick.Controls.Basic
import QtWebEngine 1.2 import QtWebEngine 1.2
import FluentUI import FluentUI
import AicsKB.FileTransferManager import AicsKB.FileTransferManager
import SignalFileOperation 1.0
import "qrc:///AicsKnowledgeBase/qml/page" import "qrc:///AicsKnowledgeBase/qml/page"
FluArea { FluArea {
id: content_area id: content_area
paddings: 0 paddings: 0
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
visible: false
property string type: "" property string type: ""
property string knowledgeFileId property string knowledgeFileId
signal download(string knowledgeFileId) signal download(string knowledgeFileId)
@ -23,6 +25,13 @@ FluArea {
// bottom: 10 // bottom: 10
// left: 10 // left: 10
// } // }
Connections {
target: SignalFileOperation
function onOpen(file) {
content_area.visible = true
}
}
FluScrollablePage { FluScrollablePage {
id: content_page id: content_page
anchors.fill: parent anchors.fill: parent

View File

@ -54,6 +54,8 @@ int main(int argc, char *argv[])
qmlRegisterSingletonInstance<FileTransferManager>("AicsKB.FileTransferManager", 1, 0, "FileTransferManager", qmlRegisterSingletonInstance<FileTransferManager>("AicsKB.FileTransferManager", 1, 0, "FileTransferManager",
fileTransferManager); fileTransferManager);
qmlRegisterSingletonType(QUrl("qrc:/AicsKnowledgeBase/qml/global/SignalFileOperation.qml"), "SignalFileOperation", 1, 0,
"SignalFileOperation");
const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs); const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,