Sine Striker
2023-12-04 41a4103ffcce0efb6d532a15d307ab98177c997e
Update delegate
4个文件已修改
44 ■■■■■ 已修改文件
qmsetup @ 65369f 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext.cpp 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext_p.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 补丁 | 查看 | 原始文档 | blame | 历史
qmsetup
@@ -1 +1 @@
Subproject commit d5d9a3efa97633cd275a133d924ea998ea708f7a
Subproject commit 65369fcf7def72a0aeec59724cdb63e9c5f0475d
src/core/contexts/abstractwindowcontext.cpp
@@ -101,4 +101,45 @@
        return false;
    }
    bool AbstractWindowContext::isInTitleBarDraggableArea(const QPoint &pos) const {
        if (!m_titleBar) {
            // There's no title bar at all, the mouse will always be in the client area.
            return false;
        }
        if (!m_delegate->isVisible(m_titleBar) || !m_delegate->isEnabled(m_titleBar)) {
            // The title bar is hidden or disabled for some reason, treat it as there's
            // no title bar.
            return false;
        }
        QRect windowRect = {QPoint(0, 0), m_windowHandle->size()};
        QRect titleBarRect = m_delegate->mapGeometryToScene(m_titleBar);
        if (!titleBarRect.intersects(windowRect)) {
            // The title bar is totally outside the window for some reason,
            // also treat it as there's no title bar.
            return false;
        }
        for (int i = CoreWindowAgent::WindowIcon; i <= CoreWindowAgent::Close; ++i) {
            auto currentButton = m_systemButtons[i];
            if (currentButton && m_delegate->isVisible(currentButton) &&
                m_delegate->isEnabled(currentButton) &&
                m_delegate->mapGeometryToScene(currentButton).contains(pos)) {
                return true;
            }
        }
        for (auto widget : m_hitTestVisibleItems) {
            if (widget && m_delegate->isVisible(widget) && m_delegate->isEnabled(widget) &&
                m_delegate->mapGeometryToScene(widget).contains(pos)) {
                return true;
            }
        }
        if (hitTestShape().contains(pos)) {
            return true;
        }
        return false;
    }
}
src/core/contexts/abstractwindowcontext_p.h
@@ -41,6 +41,7 @@
        QRegion hitTestShape() const;
        bool isInSystemButtons(const QPoint &pos, CoreWindowAgent::SystemButton *button) const;
        bool isInTitleBarDraggableArea(const QPoint &pos) const;
    protected:
        QWindow *m_windowHandle;
src/core/contexts/win32windowcontext.cpp