From 3a5e5aea06e87710e24db0d7439ab81e3e3d301f Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周六, 09 12月 2023 17:24:04 +0800 Subject: [PATCH] fix system menu --- src/core/corewindowagent.cpp | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/corewindowagent.cpp b/src/core/corewindowagent.cpp index bea2239..d5dff5a 100644 --- a/src/core/corewindowagent.cpp +++ b/src/core/corewindowagent.cpp @@ -21,15 +21,20 @@ void CoreWindowAgentPrivate::init() { } - bool CoreWindowAgentPrivate::setup(QObject *host, WindowItemDelegate *delegate) { - auto ctx = + AbstractWindowContext *CoreWindowAgentPrivate::createContext() const { + return #ifdef Q_OS_WINDOWS - std::make_unique<Win32WindowContext>(host, delegate) + new Win32WindowContext() #else - std::make_unique<QtWindowContext>(host, window, delegate) + new QtWindowContext() #endif - ; - if (!ctx->setup()) { + ; + } + + + bool CoreWindowAgentPrivate::setup(QObject *host, WindowItemDelegate *delegate) { + std::unique_ptr<AbstractWindowContext> ctx(createContext()); + if (!ctx->setup(host, delegate)) { return false; } context = std::move(ctx); -- Gitblit v1.9.1