This commit is contained in:
zhuzichu 2023-12-14 14:43:49 +08:00
parent 299eba18ac
commit 08c458c2a1
8 changed files with 2 additions and 50 deletions

View File

@ -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 = {

View File

@ -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

View File

@ -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 = {

View File

@ -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

View File

@ -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:

View File

@ -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");

View File

@ -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);

View File

@ -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;
};