From 62e85b335ba5332fa7dc2b94f62954f9b16074eb Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 4 Sep 2023 17:59:58 +0800 Subject: [PATCH] Lazily load settings view widget Signed-off-by: Claudio Cambra --- src/gui/macOS/ui/fileprovidersettingscontroller.h | 2 ++ src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/gui/macOS/ui/fileprovidersettingscontroller.h b/src/gui/macOS/ui/fileprovidersettingscontroller.h index 74fa86fc8931e..cf3fccfc29535 100644 --- a/src/gui/macOS/ui/fileprovidersettingscontroller.h +++ b/src/gui/macOS/ui/fileprovidersettingscontroller.h @@ -32,6 +32,8 @@ class FileProviderSettingsController : public QObject [[nodiscard]] QQuickWidget *settingsViewWidget(); private: + void instantiateSettingsWidget(); + class MacImplementation; std::unique_ptr d; diff --git a/src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm b/src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm index 39028d8722f53..fb02c31476ab7 100644 --- a/src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm +++ b/src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm @@ -60,7 +60,10 @@ : QObject{parent} { d = std::make_unique(this); +} +void FileProviderSettingsController::instantiateSettingsWidget() +{ _settingsViewWidget = std::make_unique(Systray::instance()->trayEngine(), nullptr); _settingsViewWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); _settingsViewWidget->setSource(QUrl(fpSettingsQmlPath)); @@ -69,6 +72,10 @@ QQuickWidget *FileProviderSettingsController::settingsViewWidget() { + if (!_settingsViewWidget) { + instantiateSettingsWidget(); + } + return _settingsViewWidget.get(); }