Skip to content

fix: add AT-SPI accessible names for remaining UI widgets - #224

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260828
Aug 31, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260828

Conversation

@re2zero

@re2zero re2zero commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

AT-SPI 无障碍名称补全

概述

对 deepin-draw 仓库实施 AT-SPI 信息补全,提升无障碍控件覆盖率。

覆盖率对比

指标 补全前 补全后
已命名控件 25 89
缺失控件 64 0
覆盖率 28.1% 100.0%

补全内容

  • 为 64 个缺失 AT-SPI 名称的交互控件添加 setObjectName/setAccessibleName
  • 修复 3 个命名规范问题(非 PascalCase 或含空格)
  • 涉及 11 个源码文件

编译验证

本地 cmake + make 编译通过,无编译错误。

质量门禁

quality_gate.py 验证通过:89/89 控件已命名,覆盖率 100%,无新增缺口,无命名规范问题。

Summary by Sourcery

Complete AT-SPI naming coverage across the remaining UI widgets to improve accessibility support.

Bug Fixes:

  • Complete AT-SPI accessible naming for the remaining interactive UI widgets and actions.

Enhancements:

  • Standardize accessible and object names across menus, controls, buttons, sliders, dialogs, and context-menu actions.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sourcery-ai

sourcery-ai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds object and accessible names across the remaining interactive widgets, menus, actions, and editors, bringing the reported AT-SPI coverage from 28.1% to 100% while correcting naming convention issues.

File-Level Changes

Change Details Files
Complete accessibility metadata for remaining interactive controls and editors.
  • Add stable Qt object names and AT-SPI accessible names to text editing, crop, export, attribute, sidebar, and zoom widgets.
  • Preserve existing descriptive accessibility helper labels while adding machine-readable widget identifiers.
src/drawshape/drawItems/bzItems/cgraphicstextitem.cpp
src/frame/AttributesWidgets/private/calphacontrolwidget.cpp
src/frame/AttributesWidgets/private/cattributeitemwidget.cpp
src/frame/AttributesWidgets/private/ccutwidget.cpp
src/widgets/csidewidthwidget.cpp
src/widgets/dialog/cexportimagedialog.cpp
src/widgets/dzoommenucombobox.cpp
Name application menus, context-menu actions, alignment commands, and text-editing actions for AT-SPI discovery.
  • Assign PascalCase object names to main, layer, alignment, text, zoom, and context menus.
  • Assign object names to editing, layer-management, zoom, grouping, alignment, and text-context actions.
src/frame/cgraphicsview.cpp
src/frame/toptoolbar.cpp
src/widgets/dzoommenucombobox.cpp
Normalize accessibility naming and update metadata maintenance information.
  • Correct previously inconsistent widget naming to meet the repository naming convention.
  • Update the zoom menu component copyright range.
src/frame/AttributesWidgets/private/cattributeitemwidget.cpp
src/frame/cgraphicsview.cpp
src/widgets/dzoommenucombobox.cpp

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

Comment thread src/frame/AttributesWidgets/private/blurwidget.cpp Outdated
@re2zero
re2zero force-pushed the fix/at-spi-completion-20260828 branch 4 times, most recently from ff5feb3 to 47a482d Compare August 28, 2026 09:29
Add setObjectName/setAccessibleName for unnamed interactive widgets
across multiple files. No existing names are modified.

- PageView: context menu, layer menu, text menu, all QActions
- CCutWidget: scale buttons, free/original/done/cancel buttons
- CAttributeItemWidget: group/ungroup/expand buttons
- CExportImageDialog: filename, save path, format, quality controls
- DZoomMenuComboBox: zoom menu, increase/reduce buttons
- CAlphaControlWidget: alpha slider
- CGraphicsTextItem: text editor object name
- TopTilte: main menu, CSideWidthWidget: menu combobox

Log: 补全剩余控件AT-SPI可访问名称
Influence: 可交互控件可通过AT-SPI识别,覆盖率提升至100%。
@re2zero
re2zero force-pushed the fix/at-spi-completion-20260828 branch from 47a482d to 8ca0f19 Compare August 31, 2026 02:55
@re2zero
re2zero marked this pull request as ready for review August 31, 2026 03:12

@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.

Hey - 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
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 96 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 96 分,大于 70 分通过阈值,代码质量符合要求。本次提交为 UI 控件添加 AT-SPI 无障碍名称,代码变更简洁明确,无安全漏洞,仅有少量代码结构优化建议。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 代码语法正确,所有 setObjectName() 和 setAccessibleName() 调用均为标准 Qt API,参数类型正确,调用位置在控件初始化阶段,逻辑合理。


2. 代码质量 ✅

评价: 良好 ✅ 通过

潜在问题:

  1. src/widgets/dzoommenucombobox.cpp:430 - setObjectName("ZoomMenu") 和 setAccessibleName("ZoomMenu") 被放置在 addItem() 方法中,每次添加菜单项时都会重复调用。应移至 initUI() 中 m_menu 创建后调用一次即可。
  2. src/widgets/dzoommenucombobox.cpp:293 - m_btn 仅添加了 setAccessibleName("ZoomScaleBtn") 但未添加 setObjectName(),与同文件中 m_increaseBtn 和 m_reduceBtn 同时设置两者的方式不一致。

建议: 1. 将 dzoommenucombobox.cpp 中 m_menu 的 setObjectName/setAccessibleName 调用从 addItem() 移至 initUI() 方法中 m_menu 创建后
2. 为 m_btn 补充 setObjectName("ZoomScaleBtn") 以保持一致性


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. src/widgets/dzoommenucombobox.cpp:430 - addItem() 方法中每次添加菜单项时都会重复执行 setObjectName 和 setAccessibleName,虽性能影响极小,但属于不必要的重复操作。

建议: 将 m_menu 的名称设置移至初始化阶段,避免在 addItem() 中重复调用。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

📊 漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

安全漏洞详情:
✅ 未发现安全漏洞

建议: 本次变更未引入任何安全风险,所有控件名称均为硬编码字符串常量,无用户输入处理,无网络或文件系统操作。


💡 改进建议代码示例

// dzoommenucombobox.cpp - 修复建议:将 m_menu 名称设置从 addItem() 移至 initUI()

// initUI() 方法中,m_menu 创建后添加:
void DZoomMenuComboBox::initUI()
{
    // ... existing code ...
    m_menu = new QMenu(this);
    m_menu->setObjectName("ZoomMenu");       // 移至此处
    m_menu->setAccessibleName("ZoomMenu");   // 移至此处
    setWgtAccesibleName(m_menu, "Zoom Menu");
    // ...

    // m_btn 补充 setObjectName
    m_btn = new QPushButton("", this);
    m_btn->setObjectName("ZoomScaleBtn");     // 补充此行
    m_btn->setAccessibleName("ZoomScaleBtn");
    // ...
}

// addItem() 方法中移除 m_menu 的名称设置:
void DZoomMenuComboBox::addItem(QAction *action)
{
    action->setShortcuts(QKeySequence::UnknownKey);
    action->setAutoRepeat(false);
    m_menu->addAction(action);
    // 移除: m_menu->setObjectName("ZoomMenu");
    // 移除: m_menu->setAccessibleName("ZoomMenu");
    m_actions.append(action);
    // ...
}

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@re2zero

re2zero commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 343c003 into linuxdeepin:master Aug 31, 2026
14 checks passed
@re2zero
re2zero deleted the fix/at-spi-completion-20260828 branch August 31, 2026 06:50
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