This commit is contained in:
zhuzichu 2023-12-13 18:13:35 +08:00
parent 3c924bb0de
commit 6974b0efa6
9 changed files with 26 additions and 2 deletions

View File

@ -30,6 +30,7 @@ Item {
param.addHeader("Token","000000000000000000000") param.addHeader("Token","000000000000000000000")
}) })
FluApp.init(app) FluApp.init(app)
FluApp.windowIcon = "qrc:/example/res/image/favicon.ico"
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync() FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.darkMode = SettingsHelper.getDarkMode()

View File

@ -191,7 +191,12 @@ FluWindow {
pageMode: FluNavigationViewType.NoStack pageMode: FluNavigationViewType.NoStack
items: ItemsOriginal items: ItemsOriginal
footerItems:ItemsFooter footerItems:ItemsFooter
topPadding:FluTools.isMacos() ? 20 : 0 topPadding:{
if(window.useSystemAppBar){
return 0
}
return FluTools.isMacos() ? 20 : 0
}
displayMode:viewmodel_settings.displayMode displayMode:viewmodel_settings.displayMode
logo: "qrc:/example/res/image/favicon.ico" logo: "qrc:/example/res/image/favicon.ico"
title:"FluentUI" title:"FluentUI"

View File

@ -30,6 +30,7 @@ Item {
param.addHeader("Token","000000000000000000000") param.addHeader("Token","000000000000000000000")
}) })
FluApp.init(app) FluApp.init(app)
FluApp.windowIcon = "qrc:/example/res/image/favicon.ico"
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync() FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.darkMode = SettingsHelper.getDarkMode()

View File

@ -194,7 +194,12 @@ FluWindow {
pageMode: FluNavigationViewType.NoStack pageMode: FluNavigationViewType.NoStack
items: ItemsOriginal items: ItemsOriginal
footerItems:ItemsFooter footerItems:ItemsFooter
topPadding:FluTools.isMacos() ? 20 : 0 topPadding:{
if(window.useSystemAppBar){
return 0
}
return FluTools.isMacos() ? 20 : 0
}
displayMode:viewmodel_settings.displayMode displayMode:viewmodel_settings.displayMode
logo: "qrc:/example/res/image/favicon.ico" logo: "qrc:/example/res/image/favicon.ico"
title:"FluentUI" title:"FluentUI"

View File

@ -22,6 +22,7 @@ class FluApp : public QObject
Q_PROPERTY_AUTO(QString,initialRoute); Q_PROPERTY_AUTO(QString,initialRoute);
Q_PROPERTY_AUTO(QJsonObject,routes); Q_PROPERTY_AUTO(QJsonObject,routes);
Q_PROPERTY_AUTO(bool,useSystemAppBar); Q_PROPERTY_AUTO(bool,useSystemAppBar);
Q_PROPERTY_AUTO(QString,windowIcon);
QML_NAMED_ELEMENT(FluApp) QML_NAMED_ELEMENT(FluApp)
QML_SINGLETON QML_SINGLETON
private: private:

View File

@ -175,3 +175,7 @@ QPoint FluTools::cursorPos(){
qint64 FluTools::currentTimestamp(){ qint64 FluTools::currentTimestamp(){
return QDateTime::currentMSecsSinceEpoch(); return QDateTime::currentMSecsSinceEpoch();
} }
QIcon FluTools::windowIcon(){
return QGuiApplication::windowIcon();
}

View File

@ -49,6 +49,7 @@ public:
Q_INVOKABLE bool isSoftware(); Q_INVOKABLE bool isSoftware();
Q_INVOKABLE qint64 currentTimestamp(); Q_INVOKABLE qint64 currentTimestamp();
Q_INVOKABLE QPoint cursorPos(); Q_INVOKABLE QPoint cursorPos();
Q_INVOKABLE QIcon windowIcon();
}; };
#endif // FLUTOOLS_H #endif // FLUTOOLS_H

View File

@ -6,6 +6,7 @@ import FluentUI 1.0
Window { Window {
default property alias content: container.data default property alias content: container.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true property bool closeDestory: true
property int launchMode: FluWindowType.Standard property int launchMode: FluWindowType.Standard
property var argument:({}) property var argument:({})
@ -22,6 +23,7 @@ Window {
showMinimize: window.showMinimize showMinimize: window.showMinimize
showMaximize: window.showMaximize showMaximize: window.showMaximize
showStayTop: window.showStayTop showStayTop: window.showStayTop
icon: window.windowIcon
} }
property color backgroundColor: { property color backgroundColor: {
if(active){ if(active){
@ -52,6 +54,7 @@ Window {
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible() signal firstVisible()
id:window id:window
flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
maximumWidth: fixSize ? width : 16777215 maximumWidth: fixSize ? width : 16777215
maximumHeight: fixSize ? height : 16777215 maximumHeight: fixSize ? height : 16777215
minimumWidth: fixSize ? width : 0 minimumWidth: fixSize ? width : 0

View File

@ -5,6 +5,7 @@ import FluentUI
Window { Window {
default property alias content: container.data default property alias content: container.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true property bool closeDestory: true
property int launchMode: FluWindowType.Standard property int launchMode: FluWindowType.Standard
property var argument:({}) property var argument:({})
@ -21,6 +22,7 @@ Window {
showMinimize: window.showMinimize showMinimize: window.showMinimize
showMaximize: window.showMaximize showMaximize: window.showMaximize
showStayTop: window.showStayTop showStayTop: window.showStayTop
icon: window.windowIcon
} }
property color backgroundColor: { property color backgroundColor: {
if(active){ if(active){
@ -51,6 +53,7 @@ Window {
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible() signal firstVisible()
id:window id:window
flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
maximumWidth: fixSize ? width : 16777215 maximumWidth: fixSize ? width : 16777215
maximumHeight: fixSize ? height : 16777215 maximumHeight: fixSize ? height : 16777215
minimumWidth: fixSize ? width : 0 minimumWidth: fixSize ? width : 0