From a51b5688e1c33d3ce96b48c869603b00f908f513 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周三, 13 12月 2023 04:16:37 +0800 Subject: [PATCH] Make better code structure for border handlers --- src/widgets/widgetwindowagent.cpp | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/widgets/widgetwindowagent.cpp b/src/widgets/widgetwindowagent.cpp index e7068fb..ff76aef 100644 --- a/src/widgets/widgetwindowagent.cpp +++ b/src/widgets/widgetwindowagent.cpp @@ -1,6 +1,10 @@ #include "widgetwindowagent.h" #include "widgetwindowagent_p.h" +#include <QtGui/QtEvents> +#include <QtGui/QPainter> +#include <QtCore/QDebug> + #include "widgetitemdelegate_p.h" namespace QWK { @@ -39,15 +43,19 @@ return false; } d->hostWidget = w; + +#ifdef Q_OS_WINDOWS + d->setupWindows10BorderWorkaround(); +#endif return true; } - const QWidget *WidgetWindowAgent::titleBar() const { + QWidget *WidgetWindowAgent::titleBar() const { Q_D(const WidgetWindowAgent); - return static_cast<const QWidget *>(d->context->titleBar()); + return static_cast<QWidget *>(d->context->titleBar()); } - void WidgetWindowAgent::setTitleBar(const QWidget *w) { + void WidgetWindowAgent::setTitleBar(QWidget *w) { Q_D(WidgetWindowAgent); if (!d->context->setTitleBar(w)) { return; @@ -55,12 +63,12 @@ Q_EMIT titleBarWidgetChanged(w); } - const QWidget *WidgetWindowAgent::systemButton(SystemButton button) const { + QWidget *WidgetWindowAgent::systemButton(SystemButton button) const { Q_D(const WidgetWindowAgent); - return static_cast<const QWidget *>(d->context->systemButton(button)); + return static_cast<QWidget *>(d->context->systemButton(button)); } - void WidgetWindowAgent::setSystemButton(SystemButton button, const QWidget *w) { + void WidgetWindowAgent::setSystemButton(SystemButton button, QWidget *w) { Q_D(WidgetWindowAgent); if (!d->context->setSystemButton(button, w)) { return; @@ -84,7 +92,7 @@ } WidgetWindowAgent::WidgetWindowAgent(WidgetWindowAgentPrivate &d, QObject *parent) - : CoreWindowAgent(d, parent) { + : WindowAgentBase(d, parent) { d.init(); } } -- Gitblit v1.9.1