Skip to content

Conversation

@deepin-ci-robot
Copy link
Contributor

@deepin-ci-robot deepin-ci-robot commented Jun 6, 2025

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#489

Summary by Sourcery

Synchronize upstream QML components from linuxdeepin/dtkdeclarative, updating ScrollView and TextArea layouts, example bindings, and integrating ScrollView into the chameleon plugin.

Enhancements:

  • Migrate ScrollView.qml to use QtQuick.Templates.ScrollView with custom implicit sizing and embedded D.ScrollBar definitions
  • Enhance TextArea.qml implicitWidth and implicitHeight calculations to account for content, background, and placeholder dimensions
  • Update the example ViewQMLSource.qml to apply preview width via a dynamic Qt.binding
  • Add and register the ScrollView component in the chameleon plugin CMakeLists, qmlplugin, and resource files

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#489
@deepin-ci-robot
Copy link
Contributor Author

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-ci-robot

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

@deepin-ci-robot
Copy link
Contributor Author

deepin pr auto review

代码审查意见:

  1. ScrollView.qml 文件中缺少了 ScrollView 组件的具体实现,只是简单地引入了 org.deepin.dtk 1.0 模块,但没有定义具体的属性和方法。建议补充完整组件的实现。

  2. ViewQMLSource.qml 文件中,obj.width = Qt.binding(function () { return codePreview.width }) 这行代码使用了 Qt.binding,但并没有提供 codePreview 对象的定义,可能会导致运行时错误。建议检查 codePreview 对象是否已正确定义。

  3. qmlplugin_plugin.cpp 文件中,新增的 ScrollView 类型注册使用了 dtkRegisterType 函数,但没有提供对应的实现文件路径,可能会导致编译错误。建议提供正确的实现文件路径。

  4. qt6/src/qml/ScrollView.qml 文件中,T.ScrollView 组件的 id 属性被命名为 control,但在后续代码中使用了 control.D.ScrollBar 来访问 ScrollBar 组件,这可能会导致编译错误。建议检查 ScrollBar 组件的定义,确保其可以正确访问。

  5. qt6/src/qml/TextArea.qml 文件中,implicitWidthimplicitHeight 属性的计算逻辑有些复杂,建议简化计算逻辑,提高代码的可读性。

  6. qt6/src/qml/TextArea.qml 文件中,padding 属性使用了 DS.Style.control.padding,但没有提供 DS 模块的导入语句。建议检查 DS 模块的导入语句是否已添加。

  7. 代码中缺少对新增组件 ScrollView 的单元测试,建议添加相应的单元测试以确保组件的正确性。

  8. 代码中缺少对新增组件 ScrollView 的文档说明,建议添加相应的文档说明,以便其他开发者了解和使用该组件。

  9. 代码中缺少对新增组件 ScrollView 的版权和许可证声明,建议添加相应的声明,以确保代码的合规性。

  10. 代码中缺少对新增组件 ScrollView 的版本控制信息,建议添加相应的版本控制信息,以便跟踪组件的变更。

@18202781743 18202781743 merged commit 39488e5 into master Jun 6, 2025
9 of 13 checks passed
@18202781743 18202781743 deleted the sync-pr-489-nosync branch June 6, 2025 09:51
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 6, 2025

Reviewer's Guide

Sync upstream dtkdeclarative changes: replace the ScrollView implementation with a template-based variant that incorporates D.ScrollBar, refine TextArea implicit sizing logic, update the example’s width assignment to be reactive, and integrate ScrollView into the chameleon theme.

Sequence Diagram for Reactive Width Update in ViewQMLSource

sequenceDiagram
    participant UserCode as "User Code (ViewQMLSource.qml)"
    participant CP as codePreview
    participant QB as "Qt.binding()"
    participant Obj as obj

    UserCode ->> Obj: obj.width = Qt.binding(function(){return codePreview.width})
    activate QB
    QB ->> CP: Access width property reference
    CP -->> QB: Return width property reference
    QB ->> Obj: Establish binding for obj.width to codePreview.width
    deactivate QB
    Obj ->> Obj: obj.width now reflects codePreview.width

    UserCode ->> CP: codePreview.width changes (e.g. due to layout)
    CP ->> CP: Internal width property updated
    CP -->> QB: Notify property change (via QML Engine)
    activate QB
    QB ->> CP: Get new width value
    CP -->> QB: Return new width
    QB ->> Obj: Update obj.width with new value
    deactivate QB
    Obj ->> Obj: obj.width is updated automatically
Loading

File-Level Changes

Change Details Files
Introduce template-based ScrollView with D.ScrollBar bindings
  • Swap out QtQuick.Controls.ScrollView for T.ScrollView
  • Add imports for QtQuick, QtQuick.Controls.impl, QtQuick.Templates as T, and org.deepin.dtk
  • Compute implicitWidth/implicitHeight using content, background, and padding/insets
  • Define D.ScrollBar.vertical and D.ScrollBar.horizontal inside the control
qt6/src/qml/ScrollView.qml
Enhance TextArea implicit size calculations
  • Include contentWidth/contentHeight in Math.max for implicit dimensions
  • Retain comparisons against background and placeholder sizes
qt6/src/qml/TextArea.qml
Make example QML preview width reactive
  • Change obj.width assignment to Qt.binding for dynamic resizing
examples/exhibition/ViewQMLSource.qml
Add ScrollView component to chameleon theme
  • Append ScrollView.qml to the QML_FILES list in CMakeLists.txt
  • Register the ScrollView type in qmlplugin_plugin.cpp
  • Introduce an empty ScrollView.qml stub with license header
chameleon/CMakeLists.txt
qmlplugin/qmlplugin_plugin.cpp
chameleon/ScrollView.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 @deepin-ci-robot - I've reviewed your changes - here's some feedback:

  • The new chameleon/ScrollView.qml stub is currently empty; either implement its styling or remove it to avoid shipping a non-functional component.
  • Consider extracting the duplicated implicitWidth/implicitHeight calculations in ScrollView.qml and TextArea.qml into a shared helper to reduce code duplication.
  • In ViewQMLSource.qml you bind obj.width but leave height static – binding height as well would ensure the preview adapts fully to its container.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

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