Skip to content

Conversation

@pengfeixx
Copy link
Contributor

@pengfeixx pengfeixx commented Dec 3, 2025

Fix the issue with about window link styles

Log: Fix the issue with about window link styles
pms: BUG-342613

Summary by Sourcery

Bug Fixes:

  • Ensure the about dialog website link uses rich text formatting and shows a pointing hand cursor when hovered.

Fix the issue with about window link styles

Log: Fix the issue with about window link styles
pms: BUG-342613
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Dec 3, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#551
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 3, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the About dialog’s website label to render rich text link markup correctly and ensure it shows a hand cursor on hover without interfering with click handling.

Flow diagram for about dialog website link rendering and hover behavior

flowchart TD
  A[AboutDialog opened] --> B[websiteLink and websiteName evaluated]
  B --> C{text nonempty?}
  C -->|No| D[Label text set to empty string]
  C -->|Yes| E[Label text set using __websiteLinkTemplate with RichText]
  E --> F[Label displayed with hyperlink styling]
  F --> G[Mouse hovers over Label]
  G --> H[MouseArea covers Label]
  H --> I[Cursor shape set to PointingHandCursor]
  I --> J["Clicks handled by rich text link in Label (MouseArea does not accept buttons)"]
Loading

File-Level Changes

Change Details Files
Enable rich-text rendering and hover cursor styling for the website label in the About dialog without consuming mouse clicks.
  • Set the website label’s textFormat to Text.RichText so the templated link text is interpreted as rich text/HTML.
  • Added a MouseArea over the website label that changes the cursor to Qt.PointingHandCursor while not accepting any mouse buttons, so existing link click behavior remains unaffected.
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

deepin pr auto review

我来对这个diff进行代码审查:

  1. 语法逻辑:
  • 代码语法正确,添加的MouseArea组件语法符合QML规范
  • acceptedButtons设置为Qt.NoButton是合理的,因为这里只需要改变鼠标样式,不需要处理点击事件
  1. 代码质量:
  • 优点:

    • 添加了textFormat: Text.RichText,确保链接能正确显示
    • 使用MouseArea来改变鼠标样式,提供了更好的用户体验
    • 代码结构清晰,缩进规范
  • 建议改进:

    • 考虑添加一个tooltip来提示用户这是一个可点击的链接
    • 可以考虑将MouseArea的hoverEnabled属性显式设置为true,虽然默认就是true
  1. 代码性能:
  • 性能影响较小,MouseArea是一个轻量级组件
  • 没有明显的性能问题
  1. 代码安全:
  • 没有安全风险
  • 使用Text.RichText时要注意防范XSS攻击,但这里因为是显示预定义的模板字符串,所以风险很小

建议改进后的代码:

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 {
        id: mouseArea
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        acceptedButtons: Qt.NoButton
        hoverEnabled: true
        
        ToolTip.text: qsTr("Visit website")
        ToolTip.visible: mouseArea.containsMouse
    }
}

这些改进主要是为了提升用户体验,添加了tooltip提示,并显式声明了hoverEnabled属性使代码意图更明确。

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 - here's some feedback:

  • Setting textFormat: Text.RichText unconditionally may cause unexpected HTML interpretation (e.g., &, <, > in translated strings); consider only enabling RichText when the template actually contains HTML markup or when both websiteLink and websiteName are present.
  • The MouseArea covers the label even when websiteLabel.text is empty; consider binding visible/enabled to whether a link is actually present so you don’t add a redundant pointer handler in the non-link case.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Setting `textFormat: Text.RichText` unconditionally may cause unexpected HTML interpretation (e.g., `&`, `<`, `>` in translated strings); consider only enabling `RichText` when the template actually contains HTML markup or when both `websiteLink` and `websiteName` are present.
- The `MouseArea` covers the label even when `websiteLabel.text` is empty; consider binding `visible`/`enabled` to whether a link is actually present so you don’t add a redundant pointer handler in the non-link case.

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.

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, mhduiy, pengfeixx

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

@pengfeixx
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Dec 4, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 24df4c9 into linuxdeepin:master Dec 4, 2025
18 of 21 checks passed
@pengfeixx pengfeixx deleted the fix-342613 branch December 4, 2025 02:48
mhduiy pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Dec 4, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

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

4 participants