From 2b5deabbdc72f278ea112139999f6e91b8e571b7 Mon Sep 17 00:00:00 2001 From: Chethan2k1 <40890937+Chethan2k1@users.noreply.github.com> Date: Thu, 10 Sep 2020 14:50:10 +0530 Subject: [PATCH] Fix breaking while using qmlRegisterSingletonInstance --- src/DeviceVerificationFlow.cpp | 4 +--- src/timeline/TimelineViewManager.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp index 70cc0baf..96fed55a 100644 --- a/src/DeviceVerificationFlow.cpp +++ b/src/DeviceVerificationFlow.cpp @@ -41,9 +41,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, this->deleteLater(); }); - connect(this,&DeviceVerificationFlow::deleteFlow,this,[this](){ - this->deleteLater(); - }); + connect(this, &DeviceVerificationFlow::deleteFlow, this, [this]() { this->deleteLater(); }); connect( ChatPage::instance(), diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index f199578f..97c119bf 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -140,8 +140,12 @@ TimelineViewManager::TimelineViewManager(QSharedPointer userSettin 0, "UserProfileModel", "UserProfile needs to be instantiated on the C++ side"); - qmlRegisterSingletonInstance("im.nheko", 1, 0, "TimelineManager", this); - qmlRegisterSingletonInstance("im.nheko", 1, 0, "Settings", settings.data()); + qmlRegisterSingletonType( + "im.nheko", 1, 0, "TimelineManager", [this](QQmlEngine *, QJSEngine *) { return this; }); + qmlRegisterSingletonType( + "im.nheko", 1, 0, "Settings", [this](QQmlEngine *, QJSEngine *) { + return this->settings.data(); + }); qRegisterMetaType(); qRegisterMetaType>();