Skip to content

fix(popup): close window popup on outside touch#652

Merged
18202781743 merged 1 commit into
masterfrom
touchpad
Jul 24, 2026
Merged

fix(popup): close window popup on outside touch#652
18202781743 merged 1 commit into
masterfrom
touchpad

Conversation

@mhduiy

@mhduiy mhduiy commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
  1. Handle touch presses delivered to the parent window as outside presses.
  2. Detect grabbed touch presses outside the popup using local coordinates.

Log: Close window popups when users touch outside them.
Influence: Restores outside-touch closing for popups.

fix(popup): 支持触摸外部区域关闭窗口弹窗

  1. 将父窗口收到的触摸按下事件作为弹窗外部操作处理。
  2. 使用局部坐标识别被弹窗抓取的外部触摸事件。

Log: 修复触摸弹窗外部区域时窗口弹窗无法关闭的问题。
PMS: BUG-370839
Influence: 恢复弹窗的外部触摸关闭行为。

1. Handle touch presses delivered to the parent window as outside presses.
2. Detect grabbed touch presses outside the popup using local coordinates.

Log: Close window popups when users touch outside them.
Influence: Restores outside-touch closing for popups.

fix(popup): 支持触摸外部区域关闭窗口弹窗

1. 将父窗口收到的触摸按下事件作为弹窗外部操作处理。
2. 使用局部坐标识别被弹窗抓取的外部触摸事件。

Log: 修复触摸弹窗外部区域时窗口弹窗无法关闭的问题。
PMS: BUG-370839
Influence: 恢复弹窗的外部触摸关闭行为。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @mhduiy, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码正确实现了触摸屏点击外部区域关闭Popup窗口的功能,逻辑清晰且无安全漏洞。
代码质量高,注释完善,修复了触摸事件未处理的缺陷,评分优秀。

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

isTouchOutsideWindow函数和eventFilter中的逻辑正确。static_cast<QTouchEvent *>(event)前已通过event->type() == QEvent::TouchBegin保证类型安全。空指针检查!windowevent->points().isEmpty()有效防止了空指针解引用。
潜在问题:无
建议:无

  • 2.代码质量(优秀)✓

新增代码命名规范,如isTouchOutsideWindowpressedOutside表意准确。注释清晰解释了某些平台popup窗口抓取触摸输入的特殊行为,有助于后续维护。
潜在问题:无
建议:无

  • 3.代码性能(无性能问题)✓

仅在触摸事件触发时进行简单的矩形包含判断,无复杂计算,不影响性能。
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓
    漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
    总体风险描述:代码未涉及外部输入解析、网络通信或文件操作,不存在可利用的安全风险。
    建议:无

■ 【改进建议代码示例】

// 代码已具备良好质量,此处提供微小的可读性优化建议,减少链式调用
static bool isTouchOutsideWindow(const QTouchEvent *event, const QWindow *window)
{
    if (!window)
        return false;

    const auto points = event->points();
    if (points.isEmpty())
        return false;

    const QRectF windowRect(QPointF(), QSizeF(window->size()));
    return !windowRect.contains(points.constFirst().position());
}

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743
18202781743 merged commit 1db07b6 into master Jul 24, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants