From 03605a234142933dc49f1a6b2fbf49ba007d87f8 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周一, 29 1月 2024 22:10:43 +0800 Subject: [PATCH] Add "setGeometry" to delegate --- src/core/contexts/abstractwindowcontext.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index ff35f76..96d215a 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -124,8 +124,7 @@ } #ifdef Q_OS_MAC - void - AbstractWindowContext::setSystemButtonAreaCallback(const ScreenRectCallback &callback) { + void AbstractWindowContext::setSystemButtonAreaCallback(const ScreenRectCallback &callback) { m_systemButtonAreaCallback = callback; virtual_hook(SystemButtonAreaChangedHook, nullptr); } @@ -206,12 +205,13 @@ if (!m_windowHandle) return; + QRect windowGeometry = m_delegate->getGeometry(m_host); QRect screenGeometry = m_windowHandle->screen()->geometry(); - int x = (screenGeometry.width() - m_windowHandle->width()) / 2; - int y = (screenGeometry.height() - m_windowHandle->height()) / 2; + int x = (screenGeometry.width() - windowGeometry.width()) / 2; + int y = (screenGeometry.height() - windowGeometry.height()) / 2; QPoint pos(x, y); pos += screenGeometry.topLeft(); - m_windowHandle->setPosition(pos); + m_delegate->setGeometry(m_host, QRect(pos, windowGeometry.size())); return; } -- Gitblit v1.9.1