From 08c458c2a1b29aeac4f7b52612977e806443fb49 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Thu, 14 Dec 2023 14:43:49 +0800 Subject: [PATCH] update --- example/qml-Qt6/App.qml | 4 ---- example/qml-Qt6/page/T_Settings.qml | 16 ---------------- example/qml/App.qml | 4 ---- example/qml/page/T_Settings.qml | 16 ---------------- example/src/helper/SettingsHelper.h | 2 -- example/src/main.cpp | 2 ++ src/WindowLifecycle.cpp | 7 ------- src/WindowLifecycle.h | 1 - 8 files changed, 2 insertions(+), 50 deletions(-) diff --git a/example/qml-Qt6/App.qml b/example/qml-Qt6/App.qml index f7e07e1f..1733aee8 100644 --- a/example/qml-Qt6/App.qml +++ b/example/qml-Qt6/App.qml @@ -16,9 +16,6 @@ Item { Connections{ target: FluApp - function onVsyncChanged(){ - SettingsHelper.saveVsync(FluApp.vsync) - } function onUseSystemAppBarChanged(){ SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar) } @@ -32,7 +29,6 @@ Item { FluApp.init(app) FluApp.windowIcon = "qrc:/example/res/image/favicon.ico" FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() - FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.enableAnimation = true FluApp.routes = { diff --git a/example/qml-Qt6/page/T_Settings.qml b/example/qml-Qt6/page/T_Settings.qml index 6ee2a234..46c76b67 100644 --- a/example/qml-Qt6/page/T_Settings.qml +++ b/example/qml-Qt6/page/T_Settings.qml @@ -56,22 +56,6 @@ FluScrollablePage{ } } - FluArea{ - Layout.fillWidth: true - Layout.topMargin: 20 - height: 50 - paddings: 10 - FluCheckBox{ - text:"V-Sync" - checked: FluApp.vsync - anchors.verticalCenter: parent.verticalCenter - onClicked: { - FluApp.vsync = !FluApp.vsync - dialog_restart.open() - } - } - } - FluArea{ Layout.fillWidth: true Layout.topMargin: 20 diff --git a/example/qml/App.qml b/example/qml/App.qml index 5c3ca084..3716b747 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -16,9 +16,6 @@ Item { Connections{ target: FluApp - function onVsyncChanged(){ - SettingsHelper.saveVsync(FluApp.vsync) - } function onUseSystemAppBarChanged(){ SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar) } @@ -32,7 +29,6 @@ Item { FluApp.init(app) FluApp.windowIcon = "qrc:/example/res/image/favicon.ico" FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() - FluApp.vsync = SettingsHelper.getVsync() FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.enableAnimation = true FluApp.routes = { diff --git a/example/qml/page/T_Settings.qml b/example/qml/page/T_Settings.qml index e06b5f43..76f74ee1 100644 --- a/example/qml/page/T_Settings.qml +++ b/example/qml/page/T_Settings.qml @@ -59,22 +59,6 @@ FluScrollablePage{ } } - FluArea{ - Layout.fillWidth: true - Layout.topMargin: 20 - height: 50 - paddings: 10 - FluCheckBox{ - text:"V-Sync" - checked: FluApp.vsync - anchors.verticalCenter: parent.verticalCenter - onClicked: { - FluApp.vsync = !FluApp.vsync - dialog_restart.open() - } - } - } - FluArea{ Layout.fillWidth: true Layout.topMargin: 20 diff --git a/example/src/helper/SettingsHelper.h b/example/src/helper/SettingsHelper.h index 65a16f97..a177c0d1 100644 --- a/example/src/helper/SettingsHelper.h +++ b/example/src/helper/SettingsHelper.h @@ -23,8 +23,6 @@ public: Q_INVOKABLE QString getRender(){return get("render").toString();} Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);} Q_INVOKABLE int getDarkMode(){return get("darkMode",QVariant(0)).toInt();} - Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);} - Q_INVOKABLE bool getVsync(){return get("vsync",QVariant(true)).toBool();} Q_INVOKABLE void saveUseSystemAppBar(bool useSystemAppBar){save("useSystemAppBar",useSystemAppBar);} Q_INVOKABLE bool getUseSystemAppBar(){return get("useSystemAppBar",QVariant(false)).toBool();} private: diff --git a/example/src/main.cpp b/example/src/main.cpp index c59ad8c8..2151488d 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -27,6 +27,8 @@ int main(int argc, char *argv[]) qputenv("QT_QUICK_CONTROLS_STYLE","Basic"); //UOSv20 does not print logs qputenv("QT_LOGGING_RULES",""); + //v-sync does not work + qputenv("QSG_RENDER_LOOP","basic"); QGuiApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setApplicationName("FluentUI"); diff --git a/src/WindowLifecycle.cpp b/src/WindowLifecycle.cpp index 790b59d8..91c1e6f7 100644 --- a/src/WindowLifecycle.cpp +++ b/src/WindowLifecycle.cpp @@ -8,7 +8,6 @@ WindowLifecycle::WindowLifecycle(QObject *parent):QObject{parent}{ void WindowLifecycle::onCompleted(QQuickWindow* window){ this->_window = window; - vsyncEnable(FluApp::getInstance()->vsync()); FluApp::getInstance()->addWindow(this->_window); } @@ -22,12 +21,6 @@ void WindowLifecycle::onDestruction(){ void WindowLifecycle::onVisible(bool visible){ } -void WindowLifecycle::vsyncEnable(bool enable){ - auto froamt = _window->format(); - froamt.setSwapInterval(enable); - _window->setFormat(froamt); -} - QVariant WindowLifecycle::createRegister(QQuickWindow* window,const QString& path){ FluRegister *p = new FluRegister(window); p->from(window); diff --git a/src/WindowLifecycle.h b/src/WindowLifecycle.h index 005bb1bb..886ff631 100644 --- a/src/WindowLifecycle.h +++ b/src/WindowLifecycle.h @@ -22,7 +22,6 @@ public: Q_INVOKABLE void onVisible(bool visible); Q_INVOKABLE void onDestoryOnClose(); Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path); - void vsyncEnable(bool enable); private: QQuickWindow* _window; };