This commit is contained in:
朱子楚\zhuzi 2023-11-23 19:58:54 +08:00
parent 35d85aa801
commit 2f3ed2bd0f
11 changed files with 50 additions and 3 deletions

View File

@ -19,6 +19,9 @@ Item {
function onVsyncChanged(){ function onVsyncChanged(){
SettingsHelper.saveVsync(FluApp.vsync) SettingsHelper.saveVsync(FluApp.vsync)
} }
function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
}
} }
FluHttpInterceptor{ FluHttpInterceptor{
@ -39,6 +42,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
FluApp.init(app) FluApp.init(app)
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync() FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true FluTheme.enableAnimation = true

View File

@ -39,6 +39,7 @@ FluContentPage{
bottom: parent.bottom bottom: parent.bottom
left: parent.left left: parent.left
} }
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
contentHeight:layout_column.height contentHeight:layout_column.height
Column{ Column{

View File

@ -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{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -19,6 +19,9 @@ Item {
function onVsyncChanged(){ function onVsyncChanged(){
SettingsHelper.saveVsync(FluApp.vsync) SettingsHelper.saveVsync(FluApp.vsync)
} }
function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
}
} }
FluHttpInterceptor{ FluHttpInterceptor{
@ -39,6 +42,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
FluApp.init(app) FluApp.init(app)
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluApp.vsync = SettingsHelper.getVsync() FluApp.vsync = SettingsHelper.getVsync()
FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true FluTheme.enableAnimation = true

View File

@ -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{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -25,6 +25,8 @@ public:
Q_INVOKABLE QVariant getDarkMode(){return get("darkMode",QVariant(0));} Q_INVOKABLE QVariant getDarkMode(){return get("darkMode",QVariant(0));}
Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);} Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);}
Q_INVOKABLE QVariant getVsync(){return get("vsync",QVariant(true));} 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: private:
void save(const QString& key,QVariant val); void save(const QString& key,QVariant val);
QVariant get(const QString& key,QVariant def={}); QVariant get(const QString& key,QVariant def={});

@ -1 +1 @@
Subproject commit 694967e930d2dd9f15c5429674005cc0a4217060 Subproject commit 49c72fb4f85421f770a6a14657ba73a9912ee833

View File

@ -14,8 +14,10 @@
FRAMELESSHELPER_USE_NAMESPACE FRAMELESSHELPER_USE_NAMESPACE
FluApp::FluApp(QObject *parent):QObject{parent}{ FluApp::FluApp(QObject *parent):QObject{parent}{
connect(this,&FluApp::useSystemAppBarChanged,this,[=]{FramelessConfig::instance()->set(Global::Option::UseSystemAppBar,_useSystemAppBar);});
vsync(true); vsync(true);
httpInterceptor(nullptr); httpInterceptor(nullptr);
useSystemAppBar(false);
} }
FluApp::~FluApp(){ FluApp::~FluApp(){

View File

@ -23,6 +23,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(FluHttpInterceptor*,httpInterceptor); Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor);
Q_PROPERTY_AUTO(bool,useSystemAppBar);
QML_NAMED_ELEMENT(FluApp) QML_NAMED_ELEMENT(FluApp)
QML_SINGLETON QML_SINGLETON
private: private:

View File

@ -38,7 +38,7 @@ Window {
property bool showMinimize: true property bool showMinimize: true
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar: false property bool useSystemAppBar
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -58,6 +58,7 @@ Window {
d.changedStayTop() d.changedStayTop()
} }
Component.onCompleted: { Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window) lifecycle.onCompleted(window)
initArgument(argument) initArgument(argument)
d.changedStayTop() d.changedStayTop()

View File

@ -37,7 +37,7 @@ Window {
property bool showMinimize: true property bool showMinimize: true
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar: false property bool useSystemAppBar
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -57,6 +57,7 @@ Window {
d.changedStayTop() d.changedStayTop()
} }
Component.onCompleted: { Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window) lifecycle.onCompleted(window)
initArgument(argument) initArgument(argument)
d.changedStayTop() d.changedStayTop()