Skip to content

chore(qml): 去除 QML import 版本号(Qt6)& 统一 SPDX 版权年份至 2026 - #3417

Draft
caixr23 wants to merge 1 commit into
masterfrom
agent/developer/0d6b5a73
Draft

caixr23 wants to merge 1 commit into
masterfrom
agent/developer/0d6b5a73

Conversation

@caixr23

@caixr23 caixr23 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

概述

对项目中改动的 *.qml 文件做两项机械变更,配合 Qt6 迁移:

  1. 去除 QML import 语句的 主版本.次版本 版本号(Qt6 不再需要)。
  2. 更新被改文件的 SPDX-FileCopyrightText 版权年份,使终止年统一为 2026(反映实际修改时间),并修复 2 处既有持有人名截断笔误。

关联 issue:DDE-105

变更范围(162 个 *.qml 文件,单 commit)

1. import 去版本号

  • 162 文件 / 724 条 import 去除版本号后缀
  • as 别名完整保留(如 import org.deepin.dtk 1.0 as Dimport org.deepin.dtk as D
  • 相对/脚本 import(如 import "DccUtils.js" as DccUtils)与已无版本号 import 原样保留
  • 无 CMake / C++ 改动qmlRegisterType / qt_add_qml_module VERSION 注册代码保持不变

2. SPDX 版权年份统一至 2026

  • 35 文件:单年 → - 2026 范围
    • 20242024 - 2026(含 1 个 //SPDX 无空格前缀写法,共 19 个)
    • 20252025 - 2026(16 个)
    • 采用 -(带空格),与仓内主流写法一致
  • 31 文件:终止年 2024 - 20272024 - 2026(文件实际在 2026 年被修改,终止年应为 2026;起始年/分隔符/持有人文字保留)
  • 2 文件…Co., Lt…Co., Ltd.(既有截断笔误补全,年份不变)
    • src/plugin-datetime/qml/RegionsChooserWindow.qml
    • src/plugin-datetime/qml/SearchableListViewPopup.qml
  • 改后 162 文件版权行终止年全部统一为 2026
  • SPDX-License-Identifier 行未动

示例

类型 修改前 修改后
import import QtQuick 2.15 import QtQuick
import 别名 import org.deepin.dtk 1.0 as D import org.deepin.dtk as D
SPDX 单年 // SPDX-FileCopyrightText: 2024 UnionTech … // SPDX-FileCopyrightText: 2024 - 2026 UnionTech …
SPDX 终止年 // SPDX-FileCopyrightText: 2024 - 2027 UnionTech … // SPDX-FileCopyrightText: 2024 - 2026 UnionTech …
SPDX 笔误 … Co., Lt … Co., Ltd.

验证

  • grep -rnE '^\s*import\s+[^ "]+\s+[0-9]+\.[0-9]+' --include=*.qml . | wc -l == 0
  • ✅ 残留 2027 版权行 == 0;不含 2026 的 SPDX-FileCopyrightText 行 == 0(162 文件终止年已统一为 2026)
  • ✅ 代码审核通过(import、35 单年/2 笔误、31 终止年 2027→2026 三轮均 100 分 / 风险 Low)
  • ✅ 本地编译通过(Qt6 / V25,qt_add_qml_module 编译期 QML 类型检查全部通过;SPDX 纯注释变更无回归,warning/error 集合与改动前逐条一致)

说明

  • 本 PR 为 draft 状态,待人工审核后再合并。
  • 基于 master 01a845985 的单次提交(fac990b85),由原 eb626fdff(import)→ f57defcc6(+ 35 单年/2 笔误)→ fac990b85(+ 31 终止年 2027→2026)逐步 amend 合入后强推更新,未新建 PR。

@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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23

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 Aug 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR performs a mechanical, project-wide cleanup of QML import statements for Qt 6 by removing explicit major.minor version numbers from module imports while preserving aliases and leaving non-versioned or relative/script imports untouched; no C++/CMake logic is changed.

Flow diagram for QML import version cleanup

flowchart TD
    QMLFile[QMLFile]
    ImportStmt["import ModuleName Major.Minor [as Alias]"]
    CleanImport["import ModuleName [as Alias]"]

    QMLFile --> ImportStmt
    ImportStmt --> CleanImport

    subgraph Rule
        V1["If import has numeric Major.Minor version"]
        V2["Remove version; keep ModuleName and optional as Alias"]
        V3['Leave imports without version or with ""-style/JS path unchanged']
        V1 --> V2 --> V3
    end

    CleanImport --> QMLFile
Loading

File-Level Changes

Change Details Files
Normalize all QML import statements to Qt 6 style by dropping explicit version numbers and keeping module aliases intact across the project.
  • Update framework imports like QtQuick, QtQuick.Controls, QtQuick.Layouts, QtQuick.Window, QtQuick.Controls.Material, QtQuick.Dialogs, QtQuick.Effects, Qt5Compat.GraphicalEffects, QtQml.Models, Qt.labs.platform, Qt.labs.qmlmodels, QtQuick.Templates to use unversioned imports.
  • Update custom/org modules (org.deepin.dtk, org.deepin.dtk.style, org.deepin.dtk.private, org.deepin.dcc and its submodules such as .defApp, .privacy, .account.biometric, .personalization, org.deepin.ds, SoundDeviceModel, ZoneInfoModel, AccountsController, etc.) to unversioned imports, preserving any existing as aliases.
  • Ensure root-only org.deepin.dcc imports in plugin entry QML files (e.g., *Main.qml, *.qml root DccObject wrappers) remain but without version numbers.
  • Leave relative/script imports and already-unversioned imports unchanged.
  • Rely on existing qmlRegisterType/qt_add_qml_module registrations without modification; no behavioral QML, C++ or build-system logic is altered.
(multiple *.qml files across src/plugin-*/qml, src/dde-control-center/plugin, src/plugin-systeminfo/qml, src/plugin-system/qml, src/plugin-device/qml, src/plugin-wacom/qml, src/plugin-touchscreen/qml, src/plugin-sound/qml, src/plugin-power/qml, src/plugin-personalization/qml, src/plugin-notification/qml, src/plugin-mouse/qml, src/plugin-keyboard/qml, src/plugin-display/qml, src/plugin-deepinid/qml, src/plugin-datetime/qml, src/plugin-defaultapp/qml, src/plugin-commoninfo/qml, src/plugin-bluetooth/qml, src/plugin-authentication/qml, src/plugin-accounts/qml, examples/plugin-example/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

@caixr23
caixr23 force-pushed the agent/developer/0d6b5a73 branch from eb626fd to f57defc Compare August 17, 2026 04:22
@caixr23 caixr23 changed the title chore(qml): 去除 QML import 版本号(Qt6) chore(qml): 去除 QML import 版本号(Qt6)& 更新 SPDX 版权年份 Aug 17, 2026
Two mechanical changes to QML files, both required for the Qt6 migration
of this project:

1. Remove `major.minor` version suffixes from QML import statements.
   Qt6 modules no longer require a version number in imports.
   - 162 *.qml files, 724 import statements updated
   - Only the version suffix is removed; `as` aliases are preserved
     (e.g. `import org.deepin.dtk 1.0 as D` -> `import org.deepin.dtk as D`)
   - Relative/script imports and already-versionless imports untouched
   - No CMake or C++ changes; qmlRegisterType / qt_add_qml_module VERSION
     registration code kept as-is

2. Update SPDX-FileCopyrightText years on the modified files so the
   end year reflects the actual 2026 modification, and fix two
   pre-existing truncation typos.
   - 35 files: single year -> ` - 2026` range
     (`2024` -> `2024 - 2026`, `2025` -> `2025 - 2026`, using the
     ` - ` spacing that matches the repo majority; includes one
     `//SPDX` no-space-prefix line)
   - 31 files: end year `2024 - 2027` -> `2024 - 2026`
     (the modification happened in 2026, so the range end year should
     be 2026, not 2027; start year/separator/holder text preserved)
   - 2 files: `Co., Lt` -> `Co., Ltd.` (truncated holder name)
   - After these changes all 162 files end at 2026; SPDX-License-Identifier
     lines left untouched

Verification:
- `grep -rnE '^\s*import\s+[^ "]+\s+[0-9]+\.[0-9]+' --include=*.qml . | wc -l` == 0
- No residual single-year (non-2026) or `2027` SPDX-FileCopyrightText
  lines on the 162 changed files
- Build verified on Qt6 (V25): qt_add_qml_module compile-time QML type
  checks pass; all 9 qmlRegisterType-registered URIs resolve correctly;
  SPDX-only diffs produced zero new warnings/errors vs the prior build

Issue: DDE-105

Signed-off-by: caixiangrong <caixiangrong@uniontech.com>
@caixr23
caixr23 force-pushed the agent/developer/0d6b5a73 branch from f57defc to fac990b Compare August 17, 2026 06:09
@caixr23 caixr23 changed the title chore(qml): 去除 QML import 版本号(Qt6)& 更新 SPDX 版权年份 chore(qml): 去除 QML import 版本号(Qt6)& 统一 SPDX 版权年份至 2026 Aug 17, 2026
@deepin-bot

deepin-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.105
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3419

@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.106
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3497

@deepin-bot

deepin-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.107
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3503

@deepin-bot

deepin-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.109
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3545

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