From a0bede6ff6a700a6eea9702c49d378f07de22f63 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周三, 06 12月 2023 12:11:37 +0800 Subject: [PATCH] Fix title bar hover bug --- src/widgets/widgetwindowagent.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/widgetwindowagent.cpp b/src/widgets/widgetwindowagent.cpp index 91f5031..8f4a76d 100644 --- a/src/widgets/widgetwindowagent.cpp +++ b/src/widgets/widgetwindowagent.cpp @@ -32,8 +32,10 @@ return false; } - std::ignore = w->winId(); // Make sure the window handle is created - if (!d->setup(w->windowHandle(), new WidgetItemDelegate())) { + w->setAttribute(Qt::WA_DontCreateNativeAncestors); + w->setAttribute(Qt::WA_NativeWindow); + + if (!d->setup(w, new WidgetItemDelegate())) { return false; } d->hostWidget = w; @@ -53,12 +55,12 @@ Q_EMIT titleBarWidgetChanged(w); } - QWidget *WidgetWindowAgent::systemButton(CoreWindowAgent::SystemButton button) const { + QWidget *WidgetWindowAgent::systemButton(SystemButton button) const { Q_D(const WidgetWindowAgent); return static_cast<QWidget *>(d->context->systemButton(button)); } - void WidgetWindowAgent::setSystemButton(CoreWindowAgent::SystemButton button, QWidget *w) { + void WidgetWindowAgent::setSystemButton(SystemButton button, QWidget *w) { Q_D(WidgetWindowAgent); if (!d->context->setSystemButton(button, w)) { return; -- Gitblit v1.9.1