This commit is contained in:
朱子楚\zhuzi
2023-10-15 17:24:33 +08:00
parent 332c0ee54e
commit 939e04e4ca
9 changed files with 66 additions and 4 deletions

View File

@ -14,6 +14,7 @@
FRAMELESSHELPER_USE_NAMESPACE
FluApp::FluApp(QObject *parent):QObject{parent}{
vsync(false);
httpInterceptor(nullptr);
}

View File

@ -19,6 +19,7 @@
class FluApp : public QObject
{
Q_OBJECT
Q_PROPERTY_AUTO(bool,vsync)
Q_PROPERTY_AUTO(QString,initialRoute);
Q_PROPERTY_AUTO(QJsonObject,routes);
Q_PROPERTY_AUTO(FluHttpInterceptor*,httpInterceptor);

View File

@ -8,6 +8,7 @@ WindowLifecycle::WindowLifecycle(QObject *parent):QObject{parent}{
void WindowLifecycle::onCompleted(QQuickWindow* window){
this->_window = window;
vsyncEnable(FluApp::getInstance()->vsync());
FluApp::getInstance()->addWindow(this->_window);
}
@ -21,6 +22,12 @@ 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,6 +22,7 @@ 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;
};