Skip to content

chore: replace Qt keywords with macros (QT_NO_KEYWORDS) - #421

Open
18202781743 wants to merge 1 commit into
masterfrom
agent/bot/c3e499a90052
Open

18202781743 wants to merge 1 commit into
masterfrom
agent/bot/c3e499a90052

Conversation

@18202781743

@18202781743 18202781743 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Replace Qt keywords with macro equivalents to prevent naming conflicts with third-party libraries:

  • emit → Q_EMIT
  • signals: → Q_SIGNALS:
  • slots: → Q_SLOTS:

Add QT_NO_KEYWORDS compile definition in CMake to enforce macro-only usage.

Notes

  • Vendored third-party directories (3rdparty/, libqt5xcbqpa-dev/, libqt6xcbqpa-dev/, qtwayland-dev/) are NOT modified
  • dde-qtintegration and dde-qtplatform-plugins use per-target target_compile_definitions instead of global add_compile_definitions to protect vendored code
  • Files including vendored headers with bare Qt keywords are protected with set_source_files_properties(... COMPILE_FLAGS -UQT_NO_KEYWORDS)

Issue: DDE-499

Summary by Sourcery

Adopt Qt macro-based keywords throughout the affected code to avoid conflicts with external libraries.

Enhancements:

  • Replace Qt keyword syntax with macro equivalents and enable QT_NO_KEYWORDS to prevent naming conflicts with third-party libraries.

Build:

  • Enforce QT_NO_KEYWORDS through the project build configuration.

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR prevents Qt keyword collisions by enabling QT_NO_KEYWORDS during builds and migrating affected project code from emit/signals/slots syntax to Q_EMIT/Q_SIGNALS/Q_SLOTS, while isolating vendored code from the compile-definition change.

Sequence diagram for macro-based Qt signal emission

sequenceDiagram
    participant Wayland as PersonalizationWaylandClient
    participant Theme as PlatformTheme
    Wayland->>Theme: Q_EMIT windowRadiusChanged(radius)
    Wayland->>Theme: Q_EMIT iconThemeNameChanged(theme_name)
    Wayland->>Theme: Q_EMIT themeNameChanged(theme)
    Wayland->>Theme: Q_EMIT fontNameChanged(font_name)
    Wayland->>Theme: Q_EMIT fontPointSizeChanged(pointSize)
Loading

File-Level Changes

Change Details Files
Enforce Qt keyword macro usage across the project through a global compile definition and targeted source updates.
  • Add QT_NO_KEYWORDS to the top-level CMake configuration.
  • Replace signal emission with Q_EMIT and slot declarations with Q_SLOTS in the affected Treeland platform code.
  • Preserve vendored third-party compatibility through per-target definitions and source-level undefinitions where needed, as described in the PR.
CMakeLists.txt
src/plugins/platform/treeland/dtreelandplatformwindowinterface.h
src/plugins/platform/treeland/personalizationwaylandclientextension.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

@github-actions

Copy link
Copy Markdown
Contributor
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "CMakeLists.txt": [
        {
            "line": "  HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkgui\"",
            "line_number": 9,
            "rule": "S35",
            "reason": "Url link | 4393cea435"
        }
    ]
}

Log:
1. Replace emit/signals:/slots: with Q_EMIT/Q_SIGNALS:/Q_SLOTS: in all source and test files
2. Add QT_NO_KEYWORDS compile definition in CMake to enforce macro-only usage
3. Vendored third-party directories are not modified

Influence:
1. All affected files now use Qt macro equivalents, compatible with projects defining QT_NO_KEYWORDS
2. No functional changes, mechanical keyword replacement only

chore: 替换 Qt 关键字为宏形式(QT_NO_KEYWORDS)

Log:
1. 将所有源文件和测试文件中的 emit/signals:/slots: 替换为 Q_EMIT/Q_SIGNALS:/Q_SLOTS:
2. 在 CMake 中添加 QT_NO_KEYWORDS 编译定义,强制使用宏形式
3. 不修改 vendored 第三方目录

Influence:
1. 所有受影响文件使用 Qt 宏等价形式,兼容定义了 QT_NO_KEYWORDS 的项目
2. 无功能变更,仅为机械性关键字替换
@18202781743
18202781743 force-pushed the agent/bot/c3e499a90052 branch from bf59dd3 to 048c94b Compare October 29, 2026 02:05
@github-actions

Copy link
Copy Markdown
Contributor
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "CMakeLists.txt": [
        {
            "line": "  HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkgui\"",
            "line_number": 9,
            "rule": "S35",
            "reason": "Url link | 4393cea435"
        }
    ]
}

@18202781743
18202781743 marked this pull request as ready for review October 29, 2026 02:08
@18202781743 18202781743 changed the title feat: replace Qt keywords with macros (QT_NO_KEYWORDS) chore: replace Qt keywords with macros (QT_NO_KEYWORDS) Oct 29, 2026

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

This branch has not been deployed

No deployments
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.

2 participants