Skip to content

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

Draft
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warnings-134
Draft

fix(dock): eliminate several QML runtime/compile warnings#1711
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warnings-134

Conversation

@Ivy233

@Ivy233 Ivy233 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor
  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

Summary by Sourcery

Remove QML runtime and type-registration warnings across dock, task manager, tray, and notification components while preserving existing behavior.

Bug Fixes:

  • Eliminate QML runtime warnings caused by unknown shell-surface signals, invalid image capture sizing, undefined notification view state, and task manager binding loops.
  • Preserve task item add animations while removing deprecated signal-handler animation syntax.

Enhancements:

  • Prevent dock sizing and tray layout updates from triggering binding loops during layout changes.
  • Register the tray drop-index value type with a compliant lowercase QML name.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ivy233

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 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Removes several QML runtime and registration warnings by making signal and view lookups safe, replacing the deprecated task-item add animation syntax, breaking dock sizing binding loops, supplying explicit drag-image sizes, and correcting the tray drop-index QML type name while preserving existing behavior.

Flow diagram for warning-safe dock and notification behavior

flowchart LR
    ShellSurface[Shell surface] -->|cursorShapeRequested| Proxy[ShellSurfaceItemProxy]
    Proxy -->|ignore unknown signals| SafeSignal[Warning-free signal handling]
    TaskModel[Task manager model] --> ListView[ListView]
    ListView -->|add Transition| AddAnimation[Scale and opacity animation]
    DockLayout[Dock layout] -->|useColumnLayout| DockSize[Return dockSize directly]
    DockLayout -->|other direction| ContentSize[Compute content-based size]
    DragItem[Dock or tray item] -->|grabToImage(width,height)| DragImage[Explicit-size drag image]
    ListViewView[ListView.view] -->|exists| Overlap[panelShown lookup]
    ListViewView -->|missing| Disabled[Animation disabled]
    DropIndex[DropIndex gadget] -->|QML_NAMED_ELEMENT| dropIndex[dropIndex value type]
Loading

File-Level Changes

Change Details Files
Make shell-surface signal handling tolerant of surface implementations that do not expose the cursor-shape signal.
  • Enable unknown-signal tolerance on the surface Connections object.
  • Verify cursor shape updates still work when the signal is available.
panels/dock/ShellSurfaceItemProxy.qml
Replace warning-prone task manager sizing and insertion animation patterns with binding-safe declarative implementations.
  • Return the dock size directly in the non-spanning implicit dimension to break the binding loop.
  • Move item add animation from ListView.onAdd to an add Transition while preserving scale and opacity animation.
panels/dock/taskmanager/package/TaskManager.qml
Provide explicit dimensions for drag-image captures across dock and tray delegates.
  • Pass each item's current width and height to grabToImage.
  • Preserve existing drag image assignment and activation behavior.
panels/dock/taskmanager/package/AppItem.qml
panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml
panels/dock/tray/quickpanel/DragItem.qml
Guard notification overlap animation initialization when the delegate is not attached to a ListView.
  • Use a null-safe ListView.view lookup with false as the fallback value.
panels/notification/center/OverlapNotify.qml
Register the tray drop-index value type with the lowercase QML name expected by the type registrar.
  • Replace automatic element naming with QML_NAMED_ELEMENT(dropIndex).
panels/dock/tray/trayitempositionmanager.h

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

@Ivy233
Ivy233 marked this pull request as ready for review August 25, 2026 08:38

@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.

Hey - 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.

@Ivy233
Ivy233 marked this pull request as draft August 25, 2026 08:42
@Ivy233
Ivy233 force-pushed the fix/dde-shell-warnings-134 branch 2 times, most recently from c879751 to c2e1cec Compare August 25, 2026 12:53
Fix a set of compiler and QML runtime warnings:

- Enable -Werror for C/C++ and guard the clang-format targets so the
  build fails on warnings instead of silently ignoring them; only set up
  the format/commit hooks when clang-format is available.
- Register the D_APPLET_CLASS macro as an AUTOMOC macro name for the
  notification server test to silence its moc warning.
- AppletDockItem: coerce Applet.visible/supported to bool with !!
  operators to avoid assigning undefined to a bool property.
- ShellSurfaceItemProxy: connect the cursorShapeRequested signal
  dynamically and only when the surface exposes it (PluginPopup), since
  a static Connections handler warned that no matching signal exists.
- TaskManager: drop the implicitWidth/implicitHeight binding loop by
  returning the fixed dock size in the layout direction that does not
  depend on appContainer, and give the onAdd animation an id so the
  deprecated object-to-signal-handler assignment is avoided.
- AppItem: resolve the Drag.active binding loop by setting Drag.active
  imperatively from the MouseArea's drag handler instead of binding it
  to the driving property.
- TrayItemPositionManager: register the DropIndex value type under the
  lowercase name dropIndex via QML_NAMED_ELEMENT, so qmltyperegistrar
  stops warning about its value-type name while keeping the C++ struct
  name unchanged; also use Qt::QueuedConnection for the
  dockHeightChanged -> updateVisualSize connection to break the
  synchronous signal/slot cascade that causes the "Binding loop detected
  for dockItemMaxSize" warning.
- OverlapNotify: guard the panelShown lookup so an undefined
  ListView.view no longer assigns undefined to a bool property.
- Resolve dpkg -Wall -Werror build failures: reorder the member
  initializer list in AMAppItemModel to match the declaration order,
  drop the unused windowCount/initResult variables, and initialize the
  previously uninitialized needHide/needShow/anchor variables.

修复 dde-shell 及任务栏的编译与 QML 运行时告警:
- 对 C/C++ 启用 -Werror,并将 clang-format 相关目标用条件包裹,让构建
  在出现告警时报错而非静默跳过;仅在检测到 clang-format 时才构建
  格式化与提交钩子目标。
- 为通知服务测试注册额外 moc 宏 D_APPLET_CLASS,消除其必要的 moc 告警。
- AppletDockItem:对 Applet.visible/Applet.supported 使用 !! 强制转换为
  bool,避免将 undefined 赋给 bool 属性。
- ShellSurfaceItemProxy:将 cursorShapeRequested 改为仅在 surface 暴露该
  信号时(PluginPopup)动态连接,原静态 Connections 处理器会因没有匹配
  信号而告警。
- 通过在被布局方向直接返回固定的 dock 尺寸、不再依赖 appContainer,
  消除 TaskManager 的 implicitWidth/implicitHeight 绑定循环;并为委托的
  入场动画补充 id,规避已废弃的"将对象赋给信号处理器"写法。
- AppItem:改为在 mouseArea 的拖拽处理器中命令式设置 Drag.active,
  而非绑定到驱动它的属性,消除 Drag.active 绑定循环告警。
- TrayItemPositionManager:通过 QML_NAMED_ELEMENT 将 DropIndex 值类型
  注册为小写 dropIndex,在保留 C++ 结构体名的同时消除 qmltyperegistrar
  对值类型名的告警;并将 dockHeightChanged 到 updateVisualSize 的连接
  改为 Qt::QueuedConnection,打断同步 C++ 信号/槽级联,消除
  "Binding loop detected for dockItemMaxSize" 告警。
- OverlapNotify:为 panelShown 查询加空值守卫,避免未定义的
  ListView.view 将 undefined 赋给 bool 属性。
- 解决 dpkg -Wall -Werror 编译失败:调整 AMAppItemModel 的成员初始化
  列表顺序使其与声明顺序一致,移除未使用的 windowCount/initResult
  变量,并初始化先前未初始化的 needHide/needShow/anchor 变量。

PMS: TASK-394335
@Ivy233
Ivy233 force-pushed the fix/dde-shell-warnings-134 branch from c2e1cec to dfc6499 Compare August 31, 2026 09:21
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.

2 participants