diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 4c395bbb..8e7b7636 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -97,7 +97,7 @@ FluWindow { z:999 items: ItemsOriginal footerItems:ItemsFooter - topPadding:Qt.platform.os === "osx" ? 20 : 5 + topPadding:FluTools.isMacos() ? 20 : 5 displayMode:MainEvent.displayMode logo: "qrc:/example/res/image/favicon.ico" title:"FluentUI" diff --git a/src/FluTools.cpp b/src/FluTools.cpp index 837605b9..7c93eb20 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -39,4 +39,27 @@ QString FluTools::readFile(const QString &fileName) return content; } +bool FluTools::isMacos(){ +#if defined(Q_OS_MACOS) + return true; +#else + return false; +#endif +} + +bool FluTools::isLinux(){ +#if defined(Q_OS_LINUX) + return true; +#else + return false; +#endif +} + +bool FluTools::isWin(){ +#if defined(Q_OS_WIN) + return true; +#else + return false; +#endif +} diff --git a/src/FluTools.h b/src/FluTools.h index 0033d235..80a5f782 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -42,6 +42,12 @@ public: */ Q_INVOKABLE QString readFile(const QString &fileName); + Q_INVOKABLE bool isMacos(); + + Q_INVOKABLE bool isLinux(); + + Q_INVOKABLE bool isWin(); + }; #endif // FLUTOOLS_H diff --git a/src/imports/FluentUI/Controls/FluAppBar.qml b/src/imports/FluentUI/Controls/FluAppBar.qml index 283bca44..27fb70a5 100644 --- a/src/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/imports/FluentUI/Controls/FluAppBar.qml @@ -20,7 +20,7 @@ Rectangle{ property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) property bool showDark: false property bool titleVisible: true - property bool isMac: Qt.platform.os === "osx" + property bool isMac: FluTools.isMacos() property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark id:root color: Qt.rgba(0,0,0,0)