diff --git a/.gitignore b/.gitignore index 9491a2f..2399643 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,7 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +cmake-build-*/ +.idea/ \ No newline at end of file diff --git a/AicsKnowledgeBase/CMakeLists.txt b/AicsKnowledgeBase/CMakeLists.txt index ef8b931..b49d4e5 100644 --- a/AicsKnowledgeBase/CMakeLists.txt +++ b/AicsKnowledgeBase/CMakeLists.txt @@ -51,4 +51,4 @@ target_link_libraries(AicsKnowledgeBase PRIVATE fluentuiplugin FramelessHelper::Core FramelessHelper::Quick -) \ No newline at end of file +) diff --git a/AicsKnowledgeBase/qml/App.qml b/AicsKnowledgeBase/qml/App.qml new file mode 100644 index 0000000..cd058a1 --- /dev/null +++ b/AicsKnowledgeBase/qml/App.qml @@ -0,0 +1,18 @@ +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts +import FluentUI + +Window { + id: app + Component.onCompleted: { + FluApp.init(app); + FluTheme.darkMode = FluDarkMode.System; + FluApp.routes = { + "/": "qrc:/AicsKnowledgeBase/qml/MainWindow.qml" + }; + FluApp.initialRoute = "/"; + FluApp.run(); + } +} diff --git a/AicsKnowledgeBase/qml/LoginPage.qml b/AicsKnowledgeBase/qml/LoginPage.qml index 5c67daa..70fc9a2 100644 --- a/AicsKnowledgeBase/qml/LoginPage.qml +++ b/AicsKnowledgeBase/qml/LoginPage.qml @@ -5,124 +5,88 @@ import QtQuick.Window import QtQuick.Layouts import org.wangwenx190.FramelessHelper -FluWindow{ - width: 640 - height: 480 - visible: true - title: qsTr("Hello World") - color: "transparent" +Row { + anchors.fill: parent - property alias titleVisible: title_bar.titleVisible - property bool appBarVisible: true + Rectangle { + id: introdutcitonItem + height: parent.height + width: parent.width * 0.5 + color: "#f3fbff" - FluAppBar { - id: title_bar - title: window.title - visible: window.appBarVisible - anchors { - top: parent.top - left: parent.left - right: parent.right - } - darkText: lang.dark_mode - } - - Item{ - id:container - anchors{ - top: title_bar.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - clip: true - } - - FramelessHelper{ - id:framless_helper - onReady: { - setTitleBarItem(title_bar) - moveWindowToDesktopCenter() - setHitTestVisible(title_bar.minimizeButton()) - setHitTestVisible(title_bar.maximizeButton()) - setHitTestVisible(title_bar.closeButton()) - setWindowFixedSize(fixSize) - title_bar.maximizeButton.visible = !fixSize - if (blurBehindWindowEnabled) - window.backgroundVisible = false - window.show() + //color: "transparent" + Image { + anchors.fill: parent + fillMode: Image.PreserveAspectFit + source: "qrc:/AicsKnowledgeBase/res/login_background.webp" } } - function setHitTestVisible(com){ - framless_helper.setHitTestVisible(com) - } - function setTitleBarItem(com){ - framless_helper.setTitleBarItem(com) - } - Row{ - anchors.fill: parent - Item{ - id: introdutcitonItem - height: parent.height - width: parent.width * 0.5 - Image { - anchors.fill: parent - source: "qrc:/AicsKnowledgeBase/res/login_background.webp" - - } - } - Item{ + ColumnLayout { + id: loginRect + width: parent.width * 0.5 + height: parent.height + FluPivot { id: loginItem - height: parent.height - width: parent.width * 0.5 - FluPivot{ - anchors.fill: parent - anchors.margins: 20 + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter + Layout.margins: 20 + height: 200 - FluPivotItem{ - title: "Sign in" - contentItem:Column{ - anchors.fill: parent - anchors.margins: 20 - anchors.centerIn: parent - spacing: 12 - FluTextBox{ - placeholderText: "Account" - id: account + FluPivotItem { + title: "登录" + + contentItem: Column { + anchors.margins: { + top: 10 + } + anchors.top: parent.top + spacing: 12 + + + FluTextBox { + anchors.left: parent.left + anchors.right: parent.right + id: account + placeholderText: "用户名" + } + FluPasswordBox { + anchors.left: parent.left + anchors.right: parent.right + id: password + placeholderText: "密码" + } + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + FluCheckBox { + Layout.alignment: Qt.AlignLeft + //anchors.left: parent.left + text: "记住密码" } - FluPasswordBox{ - placeholderText: "Password" - id: password + FluTextButton { + Layout.alignment: Qt.AlignRight + //anchors.right: parent.right + text: "忘记密码?" } - Row{ - spacing: 25 - FluCheckBox{ - text: "Remember me" - } - FluTextButton{ - text: "Forgot your password?" - } - } - FluFilledButton{ - text: "Sign in" - anchors.horizontalCenter: parent.horizontalCenter - normalColor: "green" - } - - - + } + FluFilledButton { + anchors.horizontalCenter: parent.horizontalCenter + normalColor: "green" + text: "登录" } } - FluPivotItem{ - title: "Register" -// Rectangle{ -// anchors.fill: parent -// color: "blue" -// } - } + } + FluPivotItem { + title: "注册" + // Rectangle{ + // anchors.fill: parent + // color: "blue" + // } } } } + + } diff --git a/AicsKnowledgeBase/qml/MainWindow.qml b/AicsKnowledgeBase/qml/MainWindow.qml new file mode 100644 index 0000000..ff8fdcf --- /dev/null +++ b/AicsKnowledgeBase/qml/MainWindow.qml @@ -0,0 +1,76 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Controls.Basic +import FluentUI +import org.wangwenx190.FramelessHelper + +FluWindow { + property bool appBarVisible: true + + function setHitTestVisible(com) { + framless_helper.setHitTestVisible(com) + } + function setTitleBarItem(com) { + framless_helper.setTitleBarItem(com) + } + id: window + //color: "transparent" + height: 420 + title: "智能客服知识库" + width: 640 + + FluAppBar { + id: title_bar + title: window.title + visible: appBarVisible + + anchors { + left: parent.left + right: parent.right + top: parent.top + } + } + /*FluIconButton { + id: refreshButton + height: 30 + iconSize: 13 + iconSource: FluentIcons.Sync + width: 30 + z: 8 + + onClicked: { + showSuccess("reload") + loader.reload() + } + + anchors { + top: title_bar.bottom + } + }*/ + FramelessHelper { + id: framless_helper + onReady: { + setTitleBarItem(title_bar) + moveWindowToDesktopCenter() + setHitTestVisible(title_bar.minimizeButton()) + setHitTestVisible(title_bar.maximizeButton()) + setHitTestVisible(title_bar.closeButton()) + //setHitTestVisible(refreshButton) + title_bar.maximizeButton.visible = true + //if (blurBehindWindowEnabled) + // window.backgroundVisible = false + window.show() + } + } + + /* FluRemoteLoader { + id: loader + anchors.fill: parent + source: "file:///D:\\Courses\\Qt\\AicsKnowledgeBase_client\\AicsKnowledgeBase\\qml\\LoginPage.qml" + }*/ + LoginPage { + anchors.fill: parent + } +} diff --git a/AicsKnowledgeBase/qml/main.qml b/AicsKnowledgeBase/qml/main.qml deleted file mode 100644 index ce4a13f..0000000 --- a/AicsKnowledgeBase/qml/main.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import QtQuick.Window -import QtQuick.Controls -import QtQuick.Controls.Basic -import FluentUI -Window { - width: 640 - height: 480 - visible: true - title: qsTr("Hello World") - FluArea{ - Layout.fillWidth: true - height: 68 - Layout.topMargin: 20 - paddings: 10 - - FluFilledButton{ - disabled:filled_button_switch.checked - text:"Filled Button" - onClicked: {} - anchors{ - verticalCenter: parent.verticalCenter - left: parent.left - } - } - } -} diff --git a/AicsKnowledgeBase/src/main.cpp b/AicsKnowledgeBase/src/main.cpp index 6d0b5e4..b5e6731 100644 --- a/AicsKnowledgeBase/src/main.cpp +++ b/AicsKnowledgeBase/src/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) QQmlApplicationEngine engine; FramelessHelper::Quick::registerTypes(&engine); - const QUrl url(u"qrc:/AicsKnowledgeBase/qml/LoginPage.qml"_qs); + const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject* obj, const QUrl& objUrl) { if (!obj && url == objUrl) @@ -37,21 +37,3 @@ int main(int argc, char* argv[]) engine.load(url); return app.exec(); } - - - -//int main(int argc, char *argv[]) -//{ -// QGuiApplication app(argc, argv); -// -// QQmlApplicationEngine engine; -// const QUrl url(u"qrc:/AicsKnowledgeBase/main.qml"_qs); -// QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, -// &app, [url](QObject *obj, const QUrl &objUrl) { -// if (!obj && url == objUrl) -// QCoreApplication::exit(-1); -// }, Qt::QueuedConnection); -// engine.load(url); -// -// return app.exec(); -//}