From 88008e16bebac1129d56d52655fdc61c72f81003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 16 Apr 2023 02:28:58 +0800 Subject: [PATCH] update --- example/AppInfo.cpp | 2 +- example/main.cpp | 1 + example/page/MainPage.qml | 18 ++++++++++++++++-- src/controls/FluAppBar.qml | 1 - src/controls/FluWindow.qml | 10 +++++++--- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/example/AppInfo.cpp b/example/AppInfo.cpp index 58585ff..418540a 100644 --- a/example/AppInfo.cpp +++ b/example/AppInfo.cpp @@ -7,7 +7,7 @@ AppInfo::AppInfo(QObject *parent) : QObject{parent} { version("1.2.4"); - changeLang("En"); + lang(new En()); } void AppInfo::changeLang(const QString& locale){ diff --git a/example/main.cpp b/example/main.cpp index 9e8358c..8c2fc10 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -16,6 +16,7 @@ int main(int argc, char *argv[]) QCoreApplication::setApplicationName("FluentUI"); QQuickStyle::setStyle("Basic"); QGuiApplication app(argc, argv); + app.setQuitOnLastWindowClosed(false); QQmlApplicationEngine engine; qmlRegisterType("Controller",1,0,"ChatController"); AppInfo* appInfo = new AppInfo(); diff --git a/example/page/MainPage.qml b/example/page/MainPage.qml index c14bb9b..fc4edf5 100644 --- a/example/page/MainPage.qml +++ b/example/page/MainPage.qml @@ -2,14 +2,16 @@ import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts -import "qrc:///global/" +import Qt.labs.platform import FluentUI +import "qrc:///global/" FluWindow { - id:rootwindow + id:window width: 1000 height: 640 title: "FluentUI" + closeDestory:false minimumWidth: 520 minimumHeight: 460 @@ -21,6 +23,18 @@ FluWindow { darkText: lang.dark_mode } + SystemTrayIcon { + visible: true + icon.source: "qrc:/res/image/favicon.ico" + + onActivated: { + window.show() + window.raise() + window.requestActivate() + } + } + + FluNavigationView{ id:nav_view anchors.fill: parent diff --git a/src/controls/FluAppBar.qml b/src/controls/FluAppBar.qml index c8a0bda..f91763a 100644 --- a/src/controls/FluAppBar.qml +++ b/src/controls/FluAppBar.qml @@ -67,7 +67,6 @@ Rectangle{ height: root.height spacing: 0 - RowLayout{ Layout.alignment: Qt.AlignVCenter Layout.rightMargin: 5 diff --git a/src/controls/FluWindow.qml b/src/controls/FluWindow.qml index 5b62274..9d11d39 100644 --- a/src/controls/FluWindow.qml +++ b/src/controls/FluWindow.qml @@ -6,7 +6,6 @@ import FluentUI ApplicationWindow { - enum LaunchMode { Standard, SingleTask, @@ -14,6 +13,7 @@ ApplicationWindow { } default property alias content: container.data + property bool closeDestory: true property int launchMode: FluWindow.Standard property string route property var argument:({}) @@ -50,8 +50,12 @@ ApplicationWindow { onClosing: (event)=>{ - //销毁窗口,释放资源 - helper.destoryWindow() + if(closeDestory){ + helper.destoryWindow() + }else{ + visible = false + event.accepted = false + } } FluInfoBar{