diff --git a/example/qml-Qt6/App.qml b/example/qml-Qt6/App.qml index 0914ed8d..f7e07e1f 100644 --- a/example/qml-Qt6/App.qml +++ b/example/qml-Qt6/App.qml @@ -30,6 +30,7 @@ Item { param.addHeader("Token","000000000000000000000") }) FluApp.init(app) + FluApp.windowIcon = "qrc:/example/res/image/favicon.ico" FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index 911927d0..76eb0785 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -191,7 +191,12 @@ FluWindow { pageMode: FluNavigationViewType.NoStack items: ItemsOriginal footerItems:ItemsFooter - topPadding:FluTools.isMacos() ? 20 : 0 + topPadding:{ + if(window.useSystemAppBar){ + return 0 + } + return FluTools.isMacos() ? 20 : 0 + } displayMode:viewmodel_settings.displayMode logo: "qrc:/example/res/image/favicon.ico" title:"FluentUI" diff --git a/example/qml/App.qml b/example/qml/App.qml index 4779cbe7..5c3ca084 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -30,6 +30,7 @@ Item { param.addHeader("Token","000000000000000000000") }) FluApp.init(app) + FluApp.windowIcon = "qrc:/example/res/image/favicon.ico" FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 271d8e35..d598b5f8 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -194,7 +194,12 @@ FluWindow { pageMode: FluNavigationViewType.NoStack items: ItemsOriginal footerItems:ItemsFooter - topPadding:FluTools.isMacos() ? 20 : 0 + topPadding:{ + if(window.useSystemAppBar){ + return 0 + } + return FluTools.isMacos() ? 20 : 0 + } displayMode:viewmodel_settings.displayMode logo: "qrc:/example/res/image/favicon.ico" title:"FluentUI" diff --git a/src/FluApp.h b/src/FluApp.h index 0cf6f9f3..10079abc 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -22,6 +22,7 @@ class FluApp : public QObject Q_PROPERTY_AUTO(QString,initialRoute); Q_PROPERTY_AUTO(QJsonObject,routes); Q_PROPERTY_AUTO(bool,useSystemAppBar); + Q_PROPERTY_AUTO(QString,windowIcon); QML_NAMED_ELEMENT(FluApp) QML_SINGLETON private: diff --git a/src/FluTools.cpp b/src/FluTools.cpp index 8207c867..2d89b81a 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -175,3 +175,7 @@ QPoint FluTools::cursorPos(){ qint64 FluTools::currentTimestamp(){ return QDateTime::currentMSecsSinceEpoch(); } + +QIcon FluTools::windowIcon(){ + return QGuiApplication::windowIcon(); +} diff --git a/src/FluTools.h b/src/FluTools.h index 44d2b55c..09882b81 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -49,6 +49,7 @@ public: Q_INVOKABLE bool isSoftware(); Q_INVOKABLE qint64 currentTimestamp(); Q_INVOKABLE QPoint cursorPos(); + Q_INVOKABLE QIcon windowIcon(); }; #endif // FLUTOOLS_H diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index a4eaba88..d8290230 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -6,6 +6,7 @@ import FluentUI 1.0 Window { default property alias content: container.data + property string windowIcon: FluApp.windowIcon property bool closeDestory: true property int launchMode: FluWindowType.Standard property var argument:({}) @@ -22,6 +23,7 @@ Window { showMinimize: window.showMinimize showMaximize: window.showMaximize showStayTop: window.showStayTop + icon: window.windowIcon } property color backgroundColor: { if(active){ @@ -52,6 +54,7 @@ Window { signal initArgument(var argument) signal firstVisible() id:window + flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint maximumWidth: fixSize ? width : 16777215 maximumHeight: fixSize ? height : 16777215 minimumWidth: fixSize ? width : 0 diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 9430fb54..4d90dc48 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -5,6 +5,7 @@ import FluentUI Window { default property alias content: container.data + property string windowIcon: FluApp.windowIcon property bool closeDestory: true property int launchMode: FluWindowType.Standard property var argument:({}) @@ -21,6 +22,7 @@ Window { showMinimize: window.showMinimize showMaximize: window.showMaximize showStayTop: window.showStayTop + icon: window.windowIcon } property color backgroundColor: { if(active){ @@ -51,6 +53,7 @@ Window { signal initArgument(var argument) signal firstVisible() id:window + flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint maximumWidth: fixSize ? width : 16777215 maximumHeight: fixSize ? height : 16777215 minimumWidth: fixSize ? width : 0