Skip to content

fix(dock): eliminate several QML runtime/compile warnings - #1706

Draft
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:agent/developer/884cf643
Draft

fix(dock): eliminate several QML runtime/compile warnings#1706
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:agent/developer/884cf643

Conversation

@mhduiy

@mhduiy mhduiy commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Eliminate several QML runtime and compile warnings in dde-shell's dock and notification center by fixing the root cause rather than downgrading log levels. Covers 6 warnings across 7 files; no warning log is downgraded.

Changes

  1. ShellSurfaceItemProxy: add ignoreUnknownSignals: true so the cursorShapeRequested handler no longer warns for surfaces lacking the signal.
  2. TaskManager: replace the deprecated ListView.onAdd: NumberAnimation object-to-signal-handler assignment with a declarative add: Transition (consistent with the existing remove: Transition).
  3. TaskManager: break the implicitWidth/implicitHeight binding loop by returning the dock size directly in the spanning layout direction (return value unchanged, dead binding computation dropped).
  4. AppItem / DragItem / ActionLegacyTrayPluginDelegate: pass an explicit target size to grabToImage to avoid the "Ignoring sourceSize request" warning.
  5. OverlapNotify: guard the panelShown lookup so an undefined ListView.view no longer assigns undefined to a bool property.
  6. trayitempositionmanager: register the DropIndex gadget as dropIndex (lowercase) so qmltyperegistrar stops warning about its value-type name; C++ struct name and QML property access unchanged.

Test

  • Dock shell surface cursor shape handling still works
  • Task manager item add animation still plays
  • Dock auto-size layout is unchanged
  • Drag image rendering for dock and tray items
  • Notification overlap animation initialization

Related

1. ShellSurfaceItemProxy: set Connections.ignoreUnknownSignals so the
cursorShapeRequested handler no longer warns for surfaces lacking the
signal.
2. TaskManager: replace the deprecated ListView.onAdd NumberAnimation
object-to-signal-handler assignment with a declarative add Transition.
3. TaskManager: break the implicitWidth/implicitHeight binding loop by
returning the dock size directly in the spanning layout direction.
4. AppItem/DragItem/ActionLegacyTrayPluginDelegate: pass an explicit
target size to grabToImage to avoid the Ignoring sourceSize request
warning.
5. OverlapNotify: guard the panelShown lookup so an undefined
ListView.view no longer assigns undefined to a bool property.
6. trayitempositionmanager: register the DropIndex gadget as dropIndex
lowercase so qmltyperegistrar stops warning about its value-type name.

Log: fix multiple QML warnings reported by journalctl/qmltyperegistrar

Influence:
1. Verify dock shell surface cursor shape handling still works
2. Verify task manager item add animation still plays
3. Verify dock auto-size layout is unchanged
4. Verify drag image rendering for dock and tray items
5. Verify notification overlap animation initialization

fix(dock): 消除任务栏与通知中心若干 QML 运行时/注册告警

1. ShellSurfaceItemProxy:为 Connections 设置 ignoreUnknownSignals,
使 cursorShapeRequested 处理器对缺少该信号的 surface 不再告警。
2. TaskManager:将弃用的 ListView.onAdd NumberAnimation 对象赋值给
信号处理器的写法改为声明式 add Transition。
3. TaskManager:在占满布局方向直接返回 dock 尺寸,打断
implicitWidth/implicitHeight 绑定环。
4. AppItem/DragItem/ActionLegacyTrayPluginDelegate:为 grabToImage 传入
显式目标尺寸,避免 Ignoring sourceSize request 告警。
5. OverlapNotify:对 panelShown 查询加空值守卫,避免未定义的
ListView.view 将 undefined 赋给 bool 属性。
6. trayitempositionmanager:将 DropIndex gadget 注册为 dropIndex
小写,使 qmltyperegistrar 不再告警其值类型名。

Log: 修复 journalctl/qmltyperegistrar 报告的多项 QML 告警

Influence:
1. 验证任务栏 shell surface 光标形状处理仍正常
2. 验证任务管理器条目添加动画仍播放
3. 验证任务栏自适应尺寸布局不变
4. 验证任务栏与托盘条目拖拽图像渲染
5. 验证通知重叠动画初始化

PMS: TASK-394379

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @mhduiy, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

sourcery-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR fixes several QML runtime/compile warnings in the dock, tray, and notification center by updating signal/connection handling, correct usage of grabToImage, layout sizing logic, animation hooks, QML type registration, and a potentially-null property access.

Sequence diagram for updated drag image capture using grabToImage

sequenceDiagram
    actor User
    participant AppItem
    participant Drag
    participant Qt

    User->>AppItem: startDrag()
    AppItem->>AppItem: grabToImage(callback, Qt.size(appItem.width, appItem.height))
    AppItem-->>AppItem: callback(result)
    AppItem->>Drag: set imageSource = result.url

    User->>Drag: initiateDrag()
    Drag->>Qt: Qt.callLater(function)
    Qt-->>Drag: function()
    Drag->>Drag: set Drag.active = true
Loading

File-Level Changes

Change Details Files
Suppress QML warnings from Connections attached to shellSurface by ignoring unknown signals.
  • Add ignoreUnknownSignals: true to the Connections object bound to shellSurface to prevent warnings when signals are absent or change.
panels/dock/ShellSurfaceItemProxy.qml
Use the full grabToImage signature to provide explicit target sizes and eliminate deprecation/parameter warnings for drag previews.
  • Update appItem.grabToImage callback calls to pass Qt.size(appItem.width, appItem.height).
  • Update root.grabToImage calls in tray delegates to pass Qt.size(root.width, root.height).
  • Update dragItem.grabToImage calls in DragItem to pass Qt.size(dragItem.width, dragItem.height).
panels/dock/taskmanager/package/AppItem.qml
panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml
panels/dock/tray/quickpanel/DragItem.qml
Simplify TaskManager implicitWidth/implicitHeight logic for column layout vs horizontal layout and move item add animation from ListView.onAdd to a DelegateModel add transition.
  • Refactor implicitWidth to early-return dockSize in column layout and compute max width only for non-column layout.
  • Refactor implicitHeight to early-return dockSize in non-column layout and compute max height only for column layout.
  • Add an add: Transition with NumberAnimation on scale and opacity in the DelegateModel.
  • Remove ListView.onAdd-based NumberAnimation from the delegate root to use the model transition instead.
panels/dock/taskmanager/package/TaskManager.qml
Adjust QML type registration of DropIndex to use a named element and fix QML registration-related warnings.
  • Replace QML_ELEMENT with QML_NAMED_ELEMENT(dropIndex) for the DropIndex struct used in tray item positioning.
panels/dock/tray/trayitempositionmanager.h
Guard OverlapNotify animation flag against a potentially-null ListView.view to avoid runtime property access warnings or errors.
  • Change enableAnimation binding to (root.ListView.view && root.ListView.view.panelShown) ?? false to safely handle null view and default to false.
panels/notification/center/OverlapNotify.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

@mhduiy
mhduiy marked this pull request as draft August 20, 2026 09:12
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