From 77f10f7c5eb8716c06eb7e0447c3fd8dbcb48d79 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: ćšć, 21 12æ 2023 23:18:58 +0800 Subject: [PATCH] minor tweaks --- src/core/contexts/abstractwindowcontext.cpp | 9 +++++++++ src/stylesupport/styleagent_p.h | 9 +++++++++ src/core/shared/qwkwindowsextra_p.h | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index a568bfd..0d72e3c 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -81,6 +81,15 @@ if (m_titleBar == item) { return false; } + + if (m_titleBar) { + // Since the title bar is changed, all items inside it should be dereferenced right away + for (auto &button : m_systemButtons) { + button = nullptr; + } + m_hitTestVisibleItems.clear(); + } + m_titleBar = item; return true; } diff --git a/src/core/shared/qwkwindowsextra_p.h b/src/core/shared/qwkwindowsextra_p.h index 850f0a2..03adf7e 100644 --- a/src/core/shared/qwkwindowsextra_p.h +++ b/src/core/shared/qwkwindowsextra_p.h @@ -16,12 +16,12 @@ #include <QWKCore/qwindowkit_windows.h> -#include <QtGui/QStyleHints> -#include <QtGui/QPalette> - #include <QtCore/private/qsystemlibrary_p.h> #include <QtCore/private/qwinregistry_p.h> +#include <QtGui/QStyleHints> +#include <QtGui/QPalette> + // Don't include this header in any header files. namespace QWK { diff --git a/src/stylesupport/styleagent_p.h b/src/stylesupport/styleagent_p.h index 3e36aaf..739a0b1 100644 --- a/src/stylesupport/styleagent_p.h +++ b/src/stylesupport/styleagent_p.h @@ -1,6 +1,15 @@ #ifndef STYLEAGENTPRIVATE_H #define STYLEAGENTPRIVATE_H +// +// W A R N I N G !!! +// ----------------- +// +// This file is not part of the QWindowKit API. It is used purely as an +// implementation detail. This header file may change from version to +// version without notice, or may even be removed. +// + #include <QWKStyleSupport/styleagent.h> #include <QtCore/QHash> -- Gitblit v1.9.1