Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Oct 28, 2025

  1. Add contextMenuVisible property to TextField to track menu visibility
  2. Update SearchEdit's editting property to include contextMenuVisible
    state
  3. Modify EditPanel to show border when context menu is visible
  4. Add onClosed handler to context menu to maintain text field focus

Log: Fixed text field losing focus when context menu is closed

Influence:

  1. Test opening context menu in text fields and search inputs
  2. Verify text field maintains focus after closing context menu
  3. Check that search edit layout remains consistent during context menu
    usage
  4. Test border visibility in text fields when context menu is open
  5. Verify search icon positioning in SearchEdit during context menu
    operations

fix: 改进带上下文菜单的文本框焦点行为

  1. 为 TextField 添加 contextMenuVisible 属性以跟踪菜单可见性
  2. 更新 SearchEdit 的 editting 属性以包含上下文菜单可见状态
  3. 修改 EditPanel 在上下文菜单可见时显示边框
  4. 添加上下文菜单关闭时的处理程序以保持文本框焦点

Log: 修复关闭上下文菜单时文本框失去焦点的问题

Influence:

  1. 测试在文本框和搜索输入中打开上下文菜单
  2. 验证关闭上下文菜单后文本框保持焦点
  3. 检查搜索编辑布局在上下文菜单使用期间保持一致
  4. 测试上下文菜单打开时文本框的边框可见性
  5. 验证上下文菜单操作期间 SearchEdit 中搜索图标的位置

PMS: BUG-315333

Summary by Sourcery

Improve TextField focus behavior by tracking context menu visibility, preserving focus on menu close, and updating SearchEdit states accordingly.

New Features:

  • Add contextMenuVisible property to TextField to track context menu visibility
  • Include contextMenuVisible in SearchEdit's editting state
  • Add onClosed handler on context menu to preserve TextField focus

Bug Fixes:

  • Fix text field losing focus when the context menu is closed

Enhancements:

  • Show EditPanel border when the context menu is visible

1. Add contextMenuVisible property to TextField to track menu visibility
2. Update SearchEdit's editting property to include contextMenuVisible
state
3. Modify EditPanel to show border when context menu is visible
4. Add onClosed handler to context menu to maintain text field focus

Log: Fixed text field losing focus when context menu is closed

Influence:
1. Test opening context menu in text fields and search inputs
2. Verify text field maintains focus after closing context menu
3. Check that search edit layout remains consistent during context menu
usage
4. Test border visibility in text fields when context menu is open
5. Verify search icon positioning in SearchEdit during context menu
operations

fix: 改进带上下文菜单的文本框焦点行为

1. 为 TextField 添加 contextMenuVisible 属性以跟踪菜单可见性
2. 更新 SearchEdit 的 editting 属性以包含上下文菜单可见状态
3. 修改 EditPanel 在上下文菜单可见时显示边框
4. 添加上下文菜单关闭时的处理程序以保持文本框焦点

Log: 修复关闭上下文菜单时文本框失去焦点的问题

Influence:
1. 测试在文本框和搜索输入中打开上下文菜单
2. 验证关闭上下文菜单后文本框保持焦点
3. 检查搜索编辑布局在上下文菜单使用期间保持一致
4. 测试上下文菜单打开时文本框的边框可见性
5. 验证上下文菜单操作期间 SearchEdit 中搜索图标的位置

PMS: BUG-315333
@18202781743 18202781743 requested review from BLumia and mhduiy October 28, 2025 07:39
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 28, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#545
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 28, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR improves text field focus behavior by introducing a contextMenuVisible state, updating SearchEdit’s editting logic to include it, adjusting EditPanel border visibility, and enforcing focus retention when the context menu closes.

Sequence diagram for context menu closing and focus retention in TextField

sequenceDiagram
participant User as actor
participant TextField
participant ContextMenu
User->>TextField: Right-click to open context menu
TextField->>ContextMenu: Show menu
ContextMenu->>TextField: onClosed event
TextField->>TextField: forceActiveFocus()
Loading

Class diagram for updated TextField, SearchEdit, and EditPanel properties

classDiagram
class TextField {
  +alertText
  +alertDuration
  +showAlert
  +contextMenuVisible
}
class EditPanel {
  +showBorder
}
class SearchEdit {
  +placeholder
  +editting
}
TextField "1" --> "1" EditPanel : background
SearchEdit <|-- TextField : inherits
Loading

File-Level Changes

Change Details Files
Track and expose context menu visibility in TextField
  • Added property alias contextMenuVisible to mirror contextMenu.visible
  • Updated EditPanel showBorder binding to include contextMenuVisible
  • Added onClosed handler on Menu to call control.forceActiveFocus()
qt6/src/qml/TextField.qml
Extend SearchEdit editting state to include context menu visibility
  • Modified editting property to OR in control.contextMenuVisible
  • Adjusted leftPadding logic to rely on updated editting state
qt6/src/qml/SearchEdit.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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 f1384b5 into linuxdeepin:master Oct 28, 2025
18 of 20 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 28, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#545
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.

4 participants