diff --git a/example/qml-Qt6/App.qml b/example/qml-Qt6/App.qml index 41288622..fe63b0f2 100644 --- a/example/qml-Qt6/App.qml +++ b/example/qml-Qt6/App.qml @@ -19,6 +19,9 @@ Item { function onVsyncChanged(){ SettingsHelper.saveVsync(FluApp.vsync) } + function onUseSystemAppBarChanged(){ + SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar) + } } FluHttpInterceptor{ @@ -39,6 +42,7 @@ Item { Component.onCompleted: { FluApp.init(app) + FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.enableAnimation = true diff --git a/example/qml-Qt6/page/T_Network.qml b/example/qml-Qt6/page/T_Network.qml index ef08e62b..67ce5869 100644 --- a/example/qml-Qt6/page/T_Network.qml +++ b/example/qml-Qt6/page/T_Network.qml @@ -39,6 +39,7 @@ FluContentPage{ bottom: parent.bottom left: parent.left } + boundsBehavior: Flickable.StopAtBounds ScrollBar.vertical: FluScrollBar {} contentHeight:layout_column.height Column{ diff --git a/example/qml-Qt6/page/T_Settings.qml b/example/qml-Qt6/page/T_Settings.qml index d38d4d35..24d5d23f 100644 --- a/example/qml-Qt6/page/T_Settings.qml +++ b/example/qml-Qt6/page/T_Settings.qml @@ -72,6 +72,22 @@ FluScrollablePage{ } } + FluArea{ + Layout.fillWidth: true + Layout.topMargin: 20 + height: 50 + paddings: 10 + FluCheckBox{ + text:"Use System AppBar" + checked: FluApp.useSystemAppBar + anchors.verticalCenter: parent.verticalCenter + onClicked: { + FluApp.useSystemAppBar = !FluApp.useSystemAppBar + dialog_restart.open() + } + } + } + FluArea{ Layout.fillWidth: true diff --git a/example/qml/App.qml b/example/qml/App.qml index d15ce98c..f8a0358a 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -19,6 +19,9 @@ Item { function onVsyncChanged(){ SettingsHelper.saveVsync(FluApp.vsync) } + function onUseSystemAppBarChanged(){ + SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar) + } } FluHttpInterceptor{ @@ -39,6 +42,7 @@ Item { Component.onCompleted: { FluApp.init(app) + FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.enableAnimation = true diff --git a/example/qml/page/T_Settings.qml b/example/qml/page/T_Settings.qml index ec3dae5b..85c95097 100644 --- a/example/qml/page/T_Settings.qml +++ b/example/qml/page/T_Settings.qml @@ -75,6 +75,21 @@ FluScrollablePage{ } } + FluArea{ + Layout.fillWidth: true + Layout.topMargin: 20 + height: 50 + paddings: 10 + FluCheckBox{ + text:"Use System AppBar" + checked: FluApp.useSystemAppBar + anchors.verticalCenter: parent.verticalCenter + onClicked: { + FluApp.useSystemAppBar = !FluApp.useSystemAppBar + dialog_restart.open() + } + } + } FluArea{ Layout.fillWidth: true diff --git a/example/src/helper/SettingsHelper.h b/example/src/helper/SettingsHelper.h index f0d843e9..826e2a33 100644 --- a/example/src/helper/SettingsHelper.h +++ b/example/src/helper/SettingsHelper.h @@ -25,6 +25,8 @@ public: Q_INVOKABLE QVariant getDarkMode(){return get("darkMode",QVariant(0));} Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);} Q_INVOKABLE QVariant getVsync(){return get("vsync",QVariant(true));} + Q_INVOKABLE void saveUseSystemAppBar(bool useSystemAppBar){save("useSystemAppBar",useSystemAppBar);} + Q_INVOKABLE QVariant getUseSystemAppBar(){return get("useSystemAppBar",QVariant(false));} private: void save(const QString& key,QVariant val); QVariant get(const QString& key,QVariant def={}); diff --git a/framelesshelper b/framelesshelper index 694967e9..49c72fb4 160000 --- a/framelesshelper +++ b/framelesshelper @@ -1 +1 @@ -Subproject commit 694967e930d2dd9f15c5429674005cc0a4217060 +Subproject commit 49c72fb4f85421f770a6a14657ba73a9912ee833 diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 788b7173..00f45700 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -14,8 +14,10 @@ FRAMELESSHELPER_USE_NAMESPACE FluApp::FluApp(QObject *parent):QObject{parent}{ + connect(this,&FluApp::useSystemAppBarChanged,this,[=]{FramelessConfig::instance()->set(Global::Option::UseSystemAppBar,_useSystemAppBar);}); vsync(true); httpInterceptor(nullptr); + useSystemAppBar(false); } FluApp::~FluApp(){ diff --git a/src/FluApp.h b/src/FluApp.h index a3ec8ac5..c7abd50e 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -23,6 +23,7 @@ class FluApp : public QObject Q_PROPERTY_AUTO(QString,initialRoute); Q_PROPERTY_AUTO(QJsonObject,routes); Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor); + Q_PROPERTY_AUTO(bool,useSystemAppBar); QML_NAMED_ELEMENT(FluApp) QML_SINGLETON private: diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 6d5aed31..8b945e6e 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -38,7 +38,7 @@ Window { property bool showMinimize: true property bool showMaximize: true property bool showStayTop: true - property bool useSystemAppBar: false + property bool useSystemAppBar property var closeListener: function(event){ if(closeDestory){ destoryOnClose() @@ -58,6 +58,7 @@ Window { d.changedStayTop() } Component.onCompleted: { + useSystemAppBar = FluApp.useSystemAppBar lifecycle.onCompleted(window) initArgument(argument) d.changedStayTop() diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 6637c8ce..3aaef56e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -37,7 +37,7 @@ Window { property bool showMinimize: true property bool showMaximize: true property bool showStayTop: true - property bool useSystemAppBar: false + property bool useSystemAppBar property var closeListener: function(event){ if(closeDestory){ destoryOnClose() @@ -57,6 +57,7 @@ Window { d.changedStayTop() } Component.onCompleted: { + useSystemAppBar = FluApp.useSystemAppBar lifecycle.onCompleted(window) initArgument(argument) d.changedStayTop()