Skip to content

Conversation

@caixr23
Copy link
Contributor

@caixr23 caixr23 commented Jan 30, 2026

Updated the V25 DCC interface documentation to reflect the latest plugin structure changes and QML naming conventions. Changed {name}.qml to {Name}.qml to follow QML naming standards. Updated plugin file structure to use Qt's qml plugin format with qmldir and lib{name}_qml.so files. Modified the plugin loading sequence description to match the new structure. Updated CMakeLists.txt minimum version requirement to 3.23+ for qt_add_qml_module support. Fixed the position of calcType DccObject in example files to be properly placed within the correct parent hierarchy.

Log: Updated plugin documentation for QML naming conventions and file structure

Influence:

  1. Verify plugin documentation accurately reflects current plugin structure
  2. Test plugin loading with the new file naming conventions
  3. Check that example plugins compile correctly with updated CMake requirements
  4. Validate that DccObject hierarchy and positioning works as described
  5. Confirm plugin metadata files follow proper naming standards

docs: 更新 V25 DCC 接口文档

更新了 V25 DCC 接口文档以反映最新的插件结构变更和 QML 命名规范。将
{name}.qml 改为 {Name}.qml 以遵循 QML 命名标准。更新了插件文件结构以使用 Qt 的 qml 插件格式,包含 qmldir 和 lib{name}_qml.so 文件。修改了插件加载 顺序描述以匹配新结构。将 CMakeLists.txt 最低版本要求更新为 3.23+ 以支持
qt_add_qml_module 函数。修复了示例文件中 calcType DccObject 的位置,确保 其正确放置在适当的父层级中。

Log: 更新插件文档以符合 QML 命名规范和文件结构

Influence:

  1. 验证插件文档准确反映当前插件结构
  2. 测试使用新文件命名规范的插件加载
  3. 检查示例插件是否使用更新的 CMake 要求正确编译
  4. 验证 DccObject 层级结构和定位按描述工作
  5. 确认插件元数据文件遵循正确的命名标准

Summary by Sourcery

Update V25 DCC interface documentation and example plugin to reflect the new QML plugin structure, naming conventions, and CMake requirements.

Documentation:

  • Document the Qt QML plugin-based structure using qmldir and lib{name}_qml.so instead of standalone QML files.
  • Align documentation with QML naming conventions by renaming example.qml/exampleMain.qml to Example.qml/ExampleMain.qml and updating the described loading sequence.
  • Clarify that the plugin name must match the DccObject name in {Name}.qml for plugin disabling logic.
  • Correct the documented DccObject hierarchy and placement of calcType in the examples to reflect actual behavior.

Tests:

  • Adjust example plugin QML and CMakeLists.txt to build with CMake 3.23+ and the updated QML module layout.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 30, 2026

Reviewer's Guide

Updates the V25 DCC interface Chinese documentation and example plugin to align with Qt QML naming conventions and Qt6 qml plugin packaging, including renaming QML entry/metadata files, adjusting the documented plugin loading flow, raising CMake minimum versions, and fixing the placement of a sample DccObject in example pages.

Sequence diagram for updated plugin loading flow with Qt QML plugin

sequenceDiagram
    participant CC as DDEControlCenter
    participant PM as PluginManager
    participant QE as QmlEngine
    participant QP as QmlPlugin_example
    participant Meta as Example_qml
    participant Main as ExampleMain_qml
    participant DObj as example_so_object
    participant example_so as example_so

    CC->>PM: request load module example
    PM->>PM: check visibility config
    alt module hidden
        PM-->>CC: stop loading
    else module visible
        PM->>QP: load Qt QML plugin example (qmldir)
        QP->>QE: register libexample_qml.so and example.so

        PM->>QE: load Example.qml
        QE->>Meta: create root DccObject
        Meta-->>PM: visible property

        alt visible is false
            PM-->>CC: stop loading
        else visible is true
            PM->>example_so: load in worker thread
            example_so-->>PM: created example_so_object
            PM->>DObj: move to main thread

            PM->>QE: set dccData to example_so_object
            PM->>QE: load ExampleMain.qml
            QE->>Main: create root DccObject (entry)
            Main->>DObj: call dccData.xxx()

            PM->>CC: insert DccObject tree into module tree
        end
    end
Loading

Flow diagram for DccObject calcType placement in example pages

flowchart TD
    A["Start: define DccObject calcType"] --> B["Set name = calcType"]
    B --> C["Set parentName = example_2/body"]
    C --> D["Set weight = 80"]
    D --> E["Place DccObject inside ExamplePage2.qml"]

    subgraph ExampleMain_qml["ExampleMain.qml"]
        EM_root["Root DccObject"]
        EM_body["example_2/body container"]
    end

    subgraph ExamplePage2_qml["ExamplePage2.qml"]
        EP2_root["DccObject example_2"]
        EP2_body["example_2/body"]
        EP2_calc["DccObject calcType"]
    end

    E --> F["Loader loads ExamplePage2.qml into example_2/body"]

    EM_root --> EM_body
    EM_body --> EP2_root
    EP2_root --> EP2_body
    EP2_body --> EP2_calc

    F --> G["Module tree uses parentName and weight to position calcType"]
    G --> H["Result: calcType appears under example_2 in UI, independent of its declaration location"]
Loading

File-Level Changes

Change Details Files
Documented new Qt qml plugin layout and loading sequence for V25 DCC plugins.
  • Replaced legacy flat plugin layout with qmldir + libexample_qml.so structure in the filesystem example.
  • Updated narrative description of plugin components to distinguish example.so, qmldir, and libexample_qml.so and what resources they contain.
  • Rewrote plugin loading steps to describe loading as a Qt qml plugin and using Example.qml/ExampleMain.qml in the new flow.
docs/v25-dcc-interface.zh_CN.md
Aligned QML file naming and examples with Qt QML PascalCase conventions.
  • Changed textual references from example.qml/exampleMain.qml to Example.qml/ExampleMain.qml and Xxx.qml in the documentation.
  • Updated the sample plugin tree listing to show Example.qml and ExampleMain.qml as main QML files.
  • Clarified that the plugin name must match the DccObject.name in {Name}.qml in comments.
docs/v25-dcc-interface.zh_CN.md
examples/plugin-example/qml/Example.qml
Raised CMake minimum version in docs and example plugin to support qt_add_qml_module and documented plugin name constraints.
  • Updated cmake_minimum_required from 3.7 to 3.23 in both the docs CMake snippet and the example plugin CMakeLists.txt.
  • Added comments explaining that 3.18 is the functional minimum for qt_add_qml_module and 3.23 is the recommended version.
  • Documented that PLUGIN_NAME must be alphanumeric and match the DccObject name in {Name}.qml for plugin disable operations.
docs/v25-dcc-interface.zh_CN.md
examples/plugin-example/CMakeLists.txt
Corrected DccObject calcType placement in example QML pages to reflect proper parent hierarchy usage.
  • Removed the calcType DccObject definition from ExampleMain.qml and ExamplePage1.qml where it was previously discouraged, and re-added/kept it only under the correct parent in ExampleMain.qml and ExamplePage2.qml.
  • Updated comments around calcType to emphasize that visual placement is controlled by parentName and weight, not source file location.
docs/v25-dcc-interface.zh_CN.md
examples/plugin-example/qml/ExamplePage1.qml
examples/plugin-example/qml/ExamplePage2.qml
examples/plugin-example/qml/ExampleMain.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 - I've found 1 issue, and left some high level feedback:

  • In the Chinese docs, the bullet example.so、qmldir为qml插件c++导出的动态库 is misleading because qmldir is not a dynamic library; consider rephrasing to distinguish the role of qmldir (module descriptor) from the .so libraries.
  • The CMake comment says qt_add_qml_module is supported from 3.18 but the minimum required version is set to 3.23; it would be clearer either to justify why 3.23 is required or to align the comment with the actual minimum requirement.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the Chinese docs, the bullet `example.so、qmldir为qml插件c++导出的动态库` is misleading because `qmldir` is not a dynamic library; consider rephrasing to distinguish the role of `qmldir` (module descriptor) from the `.so` libraries.
- The CMake comment says `qt_add_qml_module` is supported from 3.18 but the minimum required version is set to 3.23; it would be clearer either to justify why 3.23 is required or to align the comment with the actual minimum requirement.

## Individual Comments

### Comment 1
<location> `docs/v25-dcc-interface.zh_CN.md:113-114` </location>
<code_context>
 │   ├── dcc_example.dci     # 图标文件
 │   ├── ExamplePage1.qml    # 第一个示例页面的QML文件,在exampleMain.qml中加载
 │   ├── ExamplePage2.qml    # 第二个示例页面的QML文件,在exampleMain.qml中加载
-│   ├── example.qml         # 主QML文件,包含简单的插件信息
-│   └── exampleMain.qml     # 主QML文件,包含插件所有页面
</code_context>

<issue_to_address>
**suggestion (typo):** 示例注释中仍然使用旧的 `exampleMain.qml` 名称,建议改为 `ExampleMain.qml` 以与前文统一。

当前注释里的“在exampleMain.qml中加载”与前文统一约定的入口文件名 `ExampleMain.qml` 不一致,可能让人误以为是两个文件。请将这两行注释中的 `exampleMain.qml` 同步改为 `ExampleMain.qml````suggestion
│   ├── ExamplePage1.qml    # 第一个示例页面的QML文件,在ExampleMain.qml中加载
│   ├── ExamplePage2.qml    # 第二个示例页面的QML文件,在ExampleMain.qml中加载
```
</issue_to_address>

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.

Comment on lines 113 to 114
│ ├── ExamplePage1.qml # 第一个示例页面的QML文件,在exampleMain.qml中加载
│ ├── ExamplePage2.qml # 第二个示例页面的QML文件,在exampleMain.qml中加载
Copy link

Choose a reason for hiding this comment

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

suggestion (typo): 示例注释中仍然使用旧的 exampleMain.qml 名称,建议改为 ExampleMain.qml 以与前文统一。

当前注释里的“在exampleMain.qml中加载”与前文统一约定的入口文件名 ExampleMain.qml 不一致,可能让人误以为是两个文件。请将这两行注释中的 exampleMain.qml 同步改为 ExampleMain.qml

Suggested change
│ ├── ExamplePage1.qml # 第一个示例页面的QML文件,在exampleMain.qml中加载
│ ├── ExamplePage2.qml # 第二个示例页面的QML文件,在exampleMain.qml中加载
│ ├── ExamplePage1.qml # 第一个示例页面的QML文件,在ExampleMain.qml中加载
│ ├── ExamplePage2.qml # 第二个示例页面的QML文件,在ExampleMain.qml中加载

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, 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

Updated the V25 DCC interface documentation to reflect the latest plugin
structure changes and QML naming conventions. Changed {name}.qml to
{Name}.qml to follow QML naming standards. Updated plugin file structure
to use Qt's qml plugin format with qmldir and lib{name}_qml.so files.
Modified the plugin loading sequence description to match the new
structure. Updated CMakeLists.txt minimum version requirement to 3.23+
for qt_add_qml_module support. Fixed the position of calcType DccObject
in example files to be properly placed within the correct parent
hierarchy.

Log: Updated plugin documentation for QML naming conventions and file
structure

Influence:
1. Verify plugin documentation accurately reflects current plugin
structure
2. Test plugin loading with the new file naming conventions
3. Check that example plugins compile correctly with updated CMake
requirements
4. Validate that DccObject hierarchy and positioning works as described
5. Confirm plugin metadata files follow proper naming standards

docs: 更新 V25 DCC 接口文档

更新了 V25 DCC 接口文档以反映最新的插件结构变更和 QML 命名规范。将
{name}.qml 改为 {Name}.qml 以遵循 QML 命名标准。更新了插件文件结构以使用
Qt 的 qml 插件格式,包含 qmldir 和 lib{name}_qml.so 文件。修改了插件加载
顺序描述以匹配新结构。将 CMakeLists.txt 最低版本要求更新为 3.23+ 以支持
qt_add_qml_module 函数。修复了示例文件中 calcType DccObject 的位置,确保
其正确放置在适当的父层级中。

Log: 更新插件文档以符合 QML 命名规范和文件结构

Influence:
1. 验证插件文档准确反映当前插件结构
2. 测试使用新文件命名规范的插件加载
3. 检查示例插件是否使用更新的 CMake 要求正确编译
4. 验证 DccObject 层级结构和定位按描述工作
5. 确认插件元数据文件遵循正确的命名标准
@caixr23
Copy link
Contributor Author

caixr23 commented Jan 31, 2026

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Jan 31, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 7b04878 into linuxdeepin:master Jan 31, 2026
15 of 18 checks passed
@deepin-ci-robot
Copy link

deepin pr auto review

Git Diff 审查报告

1. 语法逻辑审查

1.1 版本号问题

问题: 文档中的日期 2026.1.14 存在明显错误

| 2026.1.14 | 1.1 | 修改{name}.qml为{Name}.qml(qml命名规范) | 6.1.71 |

建议: 修改为正确的日期,如 2024.1.14 或其他实际修改日期。

1.2 CMake版本要求

问题: CMake最低版本要求从3.7提升到3.23,但注释说明3.18即可支持

cmake_minimum_required(VERSION 3.23) # qt_add_qml_module函数支持最小版本3.18,建议版本3.23+

建议:

  1. 如果3.18确实可用,应降低最低版本要求以兼容更多系统
  2. 如果必须使用3.23,应更新注释说明为什么需要更高版本

1.3 QML文件命名规范

变更: 将小写qml文件名改为大写开头,如 example.qmlExample.qml
评价: 这是良好的命名规范改进,符合QML文件命名惯例。

2. 代码质量审查

2.1 文档一致性

问题: 文档中示例代码与实际文件结构不一致

  • 文档中描述的插件目录结构与实际示例代码中的结构不完全一致
  • 文档中描述的加载顺序与实际实现可能有差异

建议: 确保文档与实际代码保持一致,或者明确说明哪些是文档示例,哪些是实际实现。

2.2 注释质量

优点:

  • 添加了有意义的注释,如 // 与插件名相同
  • 保留了重要的说明注释,如 // 该文件中不能使用dccData,根对象为DccObject

建议:

  • 对复杂的QML结构添加更多注释说明
  • 对CMakeLists.txt中的关键步骤添加更详细的注释

3. 代码性能审查

3.1 插件加载顺序

变更: 修改了插件加载顺序的描述

2.  以Qt的qml插件形式加载example模块
3.  加载Example.qml,若Example.qml中根对象DccObject对象visible属性为false,则加载结束
4.  在线程中加载example.so,最后会将example.so导出的对象移动到主线程
5.  将example.so导出的对象设置为dccData,加载ExampleMain.qml。此时,ExampleMain.qml中可以使用dccData.xxx()调用example.so导出的函数
6.  加载完成,将DccObject对象插入到模块树中

评价:

  • 新的加载顺序描述更加清晰
  • 明确了qml插件的加载方式,有助于开发者理解加载过程

建议:

  • 可以添加性能优化的说明,如如何在加载过程中减少不必要的操作
  • 考虑添加延迟加载策略的说明

3.2 资源管理

变更: 将QML资源编译为动态库

libexample_qml.so为qml资源文件编译成的动态库。包含资源有:

评价:

  • 将QML资源编译为动态库可以提高加载效率
  • 有助于资源管理和版本控制

建议:

  • 可以添加关于资源编译优化的说明
  • 考虑添加资源压缩或优化策略的说明

4. 代码安全审查

4.1 插件命名规范

变更: 强调插件命名规范

# 该name会设置为插件名,只支持字母加数字,需要与{Name}.qml中DccObject的name相同,用于插件禁用操作
set(PLUGIN_NAME "example")

评价:

  • 明确了插件命名规范,有助于避免命名冲突
  • 强调了插件名与DccObject的name必须一致,有助于插件管理

建议:

  • 添加对插件名的验证机制,确保符合命名规范
  • 考虑添加插件名长度限制,防止过长的插件名导致问题

4.2 线程安全

问题: 文档中提到插件对象会被移动到主线程,但没有详细说明线程安全注意事项

控制中心插件加载是在线程中,但最终会将插件对象移到主线程。所以example.so构造函数中创建的对象需要在example.so导出类的树结构中(即子对象的父对象或祖先对象是example.so导出类),否则不会被移动到主线程,导致其中信号槽线程等不到,无法正常使用。

建议:

  • 添加更多关于线程安全的说明
  • 强调在多线程环境下如何正确使用信号槽
  • 提供线程安全编程的最佳实践示例

4.3 调试安全

问题: 文档中提到调试时不要使用asan

另外提醒,调试时候不要使用asan,因为没有使用asan的控制中心无法加载使用了asan编译的插件

建议:

  • 添加更多关于调试安全性的说明
  • 提供替代的调试方法或工具
  • 解释为什么asan会导致问题,以及可能的解决方案

5. 其他建议

  1. 文档完整性: 考虑添加更多关于插件生命周期管理的说明,包括插件的初始化、加载、运行和卸载过程。

  2. 错误处理: 添加关于插件加载失败的错误处理说明,以及如何诊断和解决常见问题。

  3. 性能优化: 提供关于插件性能优化的指南,包括如何减少内存占用和提高响应速度。

  4. 兼容性: 添加关于不同版本控制中心兼容性的说明,以及如何处理版本升级。

  5. 测试指南: 提供插件测试的最佳实践,包括单元测试、集成测试和性能测试。

总结

这次diff主要改进了QML文件的命名规范,使其更加符合QML开发惯例,并更新了插件加载顺序的描述,使其更加清晰。同时,将QML资源编译为动态库,提高了资源管理效率。

主要需要改进的地方包括:

  1. 修正文档中的日期错误
  2. 明确CMake版本要求
  3. 加强线程安全相关的说明
  4. 添加更多关于错误处理和调试的指南

总体而言,这些改进有助于提高插件开发的规范性和可维护性,但文档和代码的一致性需要进一步加强。

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