Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jun 6, 2025

  1. Added new ScrollView.qml component to chameleon and qt6 directories
  2. Registered ScrollView type in qmlplugin
  3. Updated TextArea.qml to improve implicit width/height calculations
  4. ScrollView includes custom ScrollBar implementations for vertical and
    horizontal scrolling
  5. Changes ensure consistent scrolling behavior and better text area
    sizing

The additions provide a dedicated ScrollView component with Deepin DTK
styling and proper scroll bar integration. The TextArea sizing updates
make it more responsive to content changes while maintaining proper
padding and insets.

feat: 添加 ScrollView 组件并更新 TextArea 尺寸计算

  1. 在 chameleon 和 qt6 目录中添加新的 ScrollView.qml 组件
  2. 在 qmlplugin 中注册 ScrollView 类型
  3. 更新 TextArea.qml 以改进隐式宽度/高度计算
  4. ScrollView 包含垂直和水平滚动的自定义滚动条实现
  5. 这些变更确保了一致的滚动行为和更好的文本区域尺寸计算

这些新增内容提供了具有 Deepin DTK 样式的专用 ScrollView 组件和适当的滚动
条集成。TextArea 尺寸更新使其对内容变化更加敏感,同时保持适当的填充和内
边距。

Summary by Sourcery

Add a ScrollView QML component with custom Deepin DTK scrollbars and update TextArea implicit sizing to better accommodate content and insets.

New Features:

  • Introduce a ScrollView QML component featuring integrated vertical and horizontal DTK scrollbars

Enhancements:

  • Enhance TextArea implicit width/height calculations to consider content dimensions, background insets, and placeholder sizing

Build:

  • Include ScrollView.qml in chameleon resources and register the ScrollView type in the QML plugin

1. Added new ScrollView.qml component to chameleon and qt6 directories
2. Registered ScrollView type in qmlplugin
3. Updated TextArea.qml to improve implicit width/height calculations
4. ScrollView includes custom ScrollBar implementations for vertical and
horizontal scrolling
5. Changes ensure consistent scrolling behavior and better text area
sizing

The additions provide a dedicated ScrollView component with Deepin DTK
styling and proper scroll bar integration. The TextArea sizing updates
make it more responsive to content changes while maintaining proper
padding and insets.

feat: 添加 ScrollView 组件并更新 TextArea 尺寸计算

1. 在 chameleon 和 qt6 目录中添加新的 ScrollView.qml 组件
2. 在 qmlplugin 中注册 ScrollView 类型
3. 更新 TextArea.qml 以改进隐式宽度/高度计算
4. ScrollView 包含垂直和水平滚动的自定义滚动条实现
5. 这些变更确保了一致的滚动行为和更好的文本区域尺寸计算

这些新增内容提供了具有 Deepin DTK 样式的专用 ScrollView 组件和适当的滚动
条集成。TextArea 尺寸更新使其对内容变化更加敏感,同时保持适当的填充和内
边距。
@18202781743 18202781743 requested review from BLumia and mhduiy June 6, 2025 09:06
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Jun 6, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

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

deepin pr auto review

代码审查意见:

  1. ScrollView.qml文件中,T.ScrollViewid属性被设置为control,但在后续代码中并没有使用到这个id。如果这个id没有实际用途,建议移除它以避免混淆。

  2. ScrollView.qml文件中,D.ScrollBar.verticalD.ScrollBar.horizontalactive属性被设置为control.D.ScrollBar.horizontal.activecontrol.D.ScrollBar.vertical.active,这可能会导致无限递归,因为active属性本身可能依赖于这些滚动条的状态。建议重新考虑这些属性的设置逻辑。

  3. TextArea.qml文件中,implicitWidthimplicitHeight的计算逻辑被修改,但新的计算方式可能会导致一些意外的布局行为。建议确认新的计算逻辑是否符合预期,并确保它不会影响其他组件的布局。

  4. qmlplugin_plugin.cpp文件中,dtkRegisterType函数被调用以注册ScrollView类型。如果ScrollView类型已经在其他地方注册过,这可能会导致重复注册的问题。建议检查是否有必要重复注册,或者确保注册逻辑是正确的。

  5. ScrollView.qml文件中,import QtQuick.Controls.implimport QtQuick.Templates as T的顺序可能会影响模块的加载顺序。建议检查这些导入语句的顺序是否正确,并确保它们不会引起任何问题。

  6. ScrollView.qml文件中,D.ScrollBar.verticalD.ScrollBar.horizontalparent属性被设置为control,这可能会导致滚动条在滚动视图之外的位置显示。建议检查这些滚动条的布局逻辑,确保它们正确地嵌套在滚动视图中。

  7. ScrollView.qml文件中,D.ScrollBar.verticalD.ScrollBar.horizontalxy属性被设置为control.mirrored ? 0 : control.width - widthcontrol.leftPadding,这可能会导致滚动条在镜像模式下显示不正确。建议检查这些属性的设置逻辑,并确保它们在镜像模式下能够正确地调整位置。

  8. ScrollView.qml文件中,D.ScrollBar.verticalD.ScrollBar.horizontalheightwidth属性被设置为control.availableHeightcontrol.availableWidth,这可能会导致滚动条的大小不正确。建议检查这些属性的设置逻辑,并确保它们能够正确地计算滚动条的大小。

  9. ScrollView.qml文件中,D.ScrollBar.verticalD.ScrollBar.horizontalactive属性被设置为control.D.ScrollBar.horizontal.activecontrol.D.ScrollBar.vertical.active,这可能会导致无限递归,因为active属性本身可能依赖于这些滚动条的状态。建议重新考虑这些属性的设置逻辑。

  10. TextArea.qml文件中,implicitWidthimplicitHeight的计算逻辑被修改,但新的计算方式可能会导致一些意外的布局行为。建议确认新的计算逻辑是否符合预期,并确保它不会影响其他组件的布局。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 6, 2025

Reviewer's Guide

This PR adds a new Deepin-styled ScrollView component—complete with custom vertical and horizontal scrollbars—registers it in the QML plugin and build system, and refines TextArea’s implicit sizing to better account for content, background insets, and placeholder metrics.

File-Level Changes

Change Details Files
Introduce a styled ScrollView component
  • Wrap T.ScrollView as D.ScrollView in qt6 module
  • Define implicitWidth/implicitHeight combining background and content paddings/insets
  • Embed custom Deepin DTK vertical and horizontal D.ScrollBar elements
qt6/src/qml/ScrollView.qml
chameleon/ScrollView.qml
Register ScrollView in plugin and build config
  • Add ScrollView.qml to chameleon QML_FILES in CMakeLists.txt
  • Invoke dtkRegisterType for ScrollView in qmlplugin_plugin.cpp
chameleon/CMakeLists.txt
qmlplugin/qmlplugin_plugin.cpp
Improve TextArea implicit sizing
  • Expand implicitWidth to consider contentWidth, background insets, and placeholder width
  • Expand implicitHeight to consider contentHeight, background insets, and placeholder height
qt6/src/qml/TextArea.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 @18202781743 - I've reviewed your changes and they look great!

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.

@18202781743 18202781743 merged commit d86e2e4 into linuxdeepin:master Jun 6, 2025
19 of 21 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Jun 6, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#488
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