Skip to content

Conversation

@deepin-ci-robot
Copy link
Contributor

@deepin-ci-robot deepin-ci-robot commented Dec 3, 2025

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#551

Summary by Sourcery

Improve the About dialog website label’s interactivity and rendering.

Enhancements:

  • Render the website label text as rich text to support formatted content.
  • Add a non-clickable mouse area to show a pointing-hand cursor when hovering over the website label.

Synchronize source files from linuxdeepin/dtkdeclarative.

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

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 3, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the About dialog website label to render rich text and be visually clickable by adding rich text formatting and a non-click-consuming mouse area overlay.

Flow diagram for About dialog website label QML structure changes

flowchart TD
  DialogWindow --> ColumnLayoutMain
  ColumnLayoutMain --> RowLayoutWebsite
  RowLayoutWebsite --> LabelWebsite
  LabelWebsite --> MouseAreaOverlay

  LabelWebsite:::updated
  MouseAreaOverlay:::added

  classDef updated fill:#e0f7ff,stroke:#007acc,stroke-width:1px
  classDef added fill:#e6ffe6,stroke:#00aa00,stroke-width:1px

  LabelWebsite[Label websiteLabel\ntextFormat = Text.RichText\nwrapMode = Text.WordWrap\nLayout.fillWidth = true]
  MouseAreaOverlay[MouseArea overlay\nanchors.fill = parent\ncursorShape = Qt.PointingHandCursor\nacceptedButtons = Qt.NoButton]
Loading

File-Level Changes

Change Details Files
Make the website label capable of displaying rich text and show a pointing-hand cursor when hovered.
  • Set the label’s textFormat to Text.RichText so that the website template can render rich text/HTML content.
  • Added a full-size MouseArea over the label with a pointing-hand cursor to visually indicate clickability without handling mouse buttons.
qt6/src/qml/AboutDialog.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

@deepin-ci-robot
Copy link
Contributor Author

deepin pr auto review

我来对这个 diff 进行详细分析:

  1. 语法逻辑:
  • 代码语法正确,符合 QML 语法规范
  • textFormat 设置为 Text.RichText 是合理的,因为要显示富文本链接
  • MouseArea 的配置正确,使用 acceptedButtons: Qt.NoButton 可以让鼠标事件穿透到下层的链接文本
  1. 代码质量:
  • 优点:
    • 添加了鼠标悬停效果(cursorShape: Qt.PointingHandCursor),提升了用户体验
    • 使用了 Text.RichText 来支持富文本显示
    • 保持了原有的条件判断逻辑
  • 可改进:
    • 可以考虑添加链接点击的视觉反馈效果
    • 可以添加 ToolTip 显示完整的链接地址
  1. 代码性能:
  • 性能影响较小,主要是增加了 MouseArea 组件
  • 建议优化:
    • 可以考虑设置 hoverEnabled: true 以便更好地控制悬停效果
    • 如果不需要鼠标事件穿透,可以考虑直接处理链接点击事件
  1. 代码安全:
  • 当前实现基本安全,因为使用了 acceptedButtons: Qt.NoButton
  • 建议:
    • 可以考虑添加链接验证,确保 websiteLink 是合法的 URL
    • 可以考虑添加链接白名单机制,只允许访问特定的域名

改进建议代码:

Label {
    id: websiteLabel
    font: D.DTK.fontManager.t8
    textFormat: Text.RichText
    text: (control.websiteLink === "" || control.websiteName === "") ?
              "" : control.__websiteLinkTemplate.arg(websiteLink).arg(control.websiteName)
    wrapMode: Text.WordWrap
    Layout.fillWidth: true

    MouseArea {
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        hoverEnabled: true
        
        // 添加工具提示
        ToolTip.text: control.websiteLink
        ToolTip.visible: containsMouse && control.websiteLink !== ""
        
        // 链接验证
        onEntered: {
            if (!isValidUrl(control.websiteLink)) {
                cursorShape = Qt.ForbiddenCursor
            }
        }
    }
}

// 添加链接验证函数
function isValidUrl(url) {
    try {
        new URL(url)
        return true
    } catch(e) {
        return false
    }
}

这些改进可以:

  1. 提供更好的用户体验(悬停提示)
  2. 增加安全性(URL验证)
  3. 提供更好的视觉反馈(无效链接显示禁用光标)
  4. 保持原有功能的同时增加新特性

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 there - I've reviewed your changes and they look great!


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.

@mhduiy mhduiy merged commit 7e4fe07 into master Dec 4, 2025
14 of 16 checks passed
@mhduiy mhduiy deleted the sync-pr-551-nosync branch December 4, 2025 03:06
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