Skip to content

Conversation

@pengfeixx
Copy link
Contributor

@pengfeixx pengfeixx commented Oct 21, 2025

Signals during the process of adding dock animations

Log: Signals during the process of adding dock animations
pms: BUG-314923

Summary by Sourcery

Emit dynamic position updates during dock show/hide animations by wiring QML change signals to the C++ backend and adjusting the frontend window rectangle with transform offsets.

Bug Fixes:

  • Fix missing dock position updates during hide/show animations by emitting frontendWindowRectChanged events at runtime

Enhancements:

  • Add QML Connections to listen for transform (on xcb) or size (non-xcb) changes during animations and call Panel.notifyDockPositionChanged accordingly
  • Introduce DockPanel::notifyDockPositionChanged and a new frontendWindowRect overload to apply transform offsets when computing the window rectangle

Signals during the process of adding dock animations

Log: Signals during the process of adding dock animations
pms: BUG-314923
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 21, 2025

Reviewer's Guide

Adds runtime notification of dock position during hide/show animations by wiring QML transform/size changes to a new C++ notifyDockPositionChanged API, which applies transform offsets to compute and emit updated frontend geometry.

Sequence diagram for dock position change notification during animation

sequenceDiagram
    participant QML_Dock as QML Dock
    participant DockTransform as dockTransform
    participant Panel as Panel
    participant DockPanel as DockPanel (C++)
    participant Frontend as Frontend
    Note over QML_Dock: Animation running
    DockTransform->QML_Dock: xChanged/yChanged signal
    QML_Dock->Panel: notifyDockPositionChanged(offsetX, offsetY)
    Panel->DockPanel: notifyDockPositionChanged(offsetX, offsetY)
    DockPanel->Frontend: frontendWindowRectChanged(newRect)
Loading

Class diagram for updated DockPanel methods

classDiagram
    class DockPanel {
        +QRect geometry()
        +QRect frontendWindowRect()
        +QRect frontendWindowRect(int transformOffsetX, int transformOffsetY)
        +void notifyDockPositionChanged(int offsetX, int offsetY)
        +signal frontendWindowRectChanged(QRect)
    }
Loading

File-Level Changes

Change Details Files
Link animation-driven coordinate changes in QML to the backend notification API.
  • Added Connections for dockTransform (XCB) to call Panel.notifyDockPositionChanged on x/y changes
  • Added Connections for dock (non-XCB) to call Panel.notifyDockPositionChanged on width/height changes
  • Enabled both connections only while hideShowAnimation is running
panels/dock/package/main.qml
Extend DockPanel backend to handle transform offsets and emit updated geometry.
  • Introduced frontendWindowRect(int, int) overload
  • Updated Top/Bottom/Right/Left position calculations to include transformOffsetX/transformOffsetY
  • Added notifyDockPositionChanged method that emits frontendWindowRectChanged with offset-aware rectangle
panels/dock/dockpanel.cpp

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

deepin pr auto review

我来分析这段代码的改进建议:

  1. 代码结构和逻辑:
  • 对 frontendWindowRect() 进行了重载,增加了带偏移参数的版本,这是个不错的设计。
  • 但是新增加的无参数版本直接调用带参数版本,参数都写死为0,可以考虑使用默认参数的方式来优化。
  1. 性能优化:
  • QML 中的 Connections 组件 enabled 属性使用了动态判断,这会在每次判断时都进行评估。建议将这个判断缓存到属性中。
  1. 代码安全:
  • frontendWindowRect() 中没有对 transformOffsetX/Y 进行边界检查,可能导致计算出的矩形超出屏幕范围。
  1. 建议改进:
  • 将 frontendWindowRect() 改为:
QRect DockPanel::frontendWindowRect(int transformOffsetX = 0, int transformOffsetY = 0)
  • 在 QML 中添加属性:
readonly property bool isXcb: Qt.platform.pluginName === "xcb"
  • 添加边界检查:
// 计算最终位置后
xPos = qBound(0, xPos, screenGeometry.width() - geometry.width());
yPos = qBound(0, yPos, screenGeometry.height() - geometry.height());
  1. 其他建议:
  • notifyDockPositionChanged 函数名可以考虑改为更准确的 notifyDockTransformChanged,因为它不仅处理位置变化。
  • QML 中两个 Connections 块可以合并为一个,通过条件判断来处理不同平台的情况,这样更容易维护。

这些改进可以提升代码的可维护性、安全性和性能。

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.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

deepin-bot bot commented Oct 21, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 0f80abc into linuxdeepin:master Oct 21, 2025
8 of 11 checks passed
@pengfeixx pengfeixx deleted the fix-314923 branch October 21, 2025 09:36
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