Skip to content

fix: replace ComboBox with Menu for notification actions#1523

Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
Mar 24, 2026
Merged

fix: replace ComboBox with Menu for notification actions#1523
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Mar 24, 2026

  1. Replaced the ComboBox component with a custom NotifyActionMenu for
    displaying additional notification actions
  2. Created new NotifyActionMenu.qml file implementing a Qt Labs Platform
    Menu with dynamic action items
  3. Modified NotifyAction.qml to use NotifyActionButton with actionMenu
    property instead of ComboBox
  4. Changed the "More" button behavior to open a menu instead of a
    dropdown combo box
  5. Removed complex ComboBox width calculation logic and replaced with
    simpler menu implementation

Log: Fixed notification action text truncation by replacing ComboBox
with Menu

Influence:

  1. Test notification with multiple actions to ensure all actions are
    displayed without truncation
  2. Verify that clicking the "More" button opens a menu showing all
    additional actions
  3. Check that action menu items are properly triggered and invoke the
    correct actions
  4. Test keyboard navigation between action buttons and menu items
  5. Verify visual appearance and styling of the action menu matches
    system theme
  6. Ensure menu positioning is correct relative to the notification
    action button

fix: 修复通知操作文本被截断的问题

  1. 将 ComboBox 组件替换为自定义的 NotifyActionMenu 用于显示额外的通知
    操作
  2. 创建新的 NotifyActionMenu.qml 文件,实现基于 Qt Labs Platform Menu 的
    动态操作项
  3. 修改 NotifyAction.qml,使用带有 actionMenu 属性的 NotifyActionButton
    替代 ComboBox
  4. 更改"更多"按钮行为,现在打开菜单而不是下拉组合框
  5. 移除了复杂的 ComboBox 宽度计算逻辑,替换为更简单的菜单实现

Log: 通过将 ComboBox 替换为 Menu 修复通知操作文本被截断的问题

Influence:

  1. 测试包含多个操作的通知,确保所有操作都能完整显示而不被截断
  2. 验证点击"更多"按钮能正确打开显示所有额外操作的菜单
  3. 检查菜单项是否能正确触发并调用相应的操作
  4. 测试操作按钮和菜单项之间的键盘导航功能
  5. 验证操作菜单的视觉外观和样式是否与系统主题匹配
  6. 确保菜单位置相对于通知操作按钮的定位正确

PMS: BUG-312949

Summary by Sourcery

Replace the notification actions ComboBox with a dedicated menu-based interaction to prevent text truncation and improve usability.

New Features:

  • Introduce a reusable NotifyActionMenu component backed by Qt Labs Platform Menu for displaying dynamic notification actions.

Bug Fixes:

  • Resolve notification action text truncation by switching from a width-constrained ComboBox to a menu-based action list.

Enhancements:

  • Update NotifyAction to use NotifyActionButton with an attachable action menu and simplified click behavior for the "More" actions.
  • Register the new NotifyActionMenu QML component in the notification plugin module for use across the panel.

Build:

  • Include NotifyActionMenu.qml in the notification plugin CMake QML module sources.

1. Replaced the ComboBox component with a custom NotifyActionMenu for
displaying additional notification actions
2. Created new NotifyActionMenu.qml file implementing a Qt Labs Platform
Menu with dynamic action items
3. Modified NotifyAction.qml to use NotifyActionButton with actionMenu
property instead of ComboBox
4. Changed the "More" button behavior to open a menu instead of a
dropdown combo box
5. Removed complex ComboBox width calculation logic and replaced with
simpler menu implementation

Log: Fixed notification action text truncation by replacing ComboBox
with Menu

Influence:
1. Test notification with multiple actions to ensure all actions are
displayed without truncation
2. Verify that clicking the "More" button opens a menu showing all
additional actions
3. Check that action menu items are properly triggered and invoke the
correct actions
4. Test keyboard navigation between action buttons and menu items
5. Verify visual appearance and styling of the action menu matches
system theme
6. Ensure menu positioning is correct relative to the notification
action button

fix: 修复通知操作文本被截断的问题

1. 将 ComboBox 组件替换为自定义的 NotifyActionMenu 用于显示额外的通知
操作
2. 创建新的 NotifyActionMenu.qml 文件,实现基于 Qt Labs Platform Menu 的
动态操作项
3. 修改 NotifyAction.qml,使用带有 actionMenu 属性的 NotifyActionButton
替代 ComboBox
4. 更改"更多"按钮行为,现在打开菜单而不是下拉组合框
5. 移除了复杂的 ComboBox 宽度计算逻辑,替换为更简单的菜单实现

Log: 通过将 ComboBox 替换为 Menu 修复通知操作文本被截断的问题

Influence:
1. 测试包含多个操作的通知,确保所有操作都能完整显示而不被截断
2. 验证点击"更多"按钮能正确打开显示所有额外操作的菜单
3. 检查菜单项是否能正确触发并调用相应的操作
4. 测试操作按钮和菜单项之间的键盘导航功能
5. 验证操作菜单的视觉外观和样式是否与系统主题匹配
6. 确保菜单位置相对于通知操作按钮的定位正确

PMS: BUG-312949
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 24, 2026

Reviewer's Guide

Replaces the notification actions ComboBox with a custom Qt Labs Platform Menu-based NotifyActionMenu, updates NotifyAction.qml to use a more/secondary NotifyActionButton with an attached menu instead of a dropdown, and wires up menu actions and CMake to fix truncated notification action text and simplify layout logic.

Sequence diagram for notification action menu invocation

sequenceDiagram
    actor User
    participant NotifyActionButton
    participant NotifyActionMenu
    participant NotifyActionRoot

    User->>NotifyActionButton: click()
    alt has_actionMenu
        NotifyActionButton->>NotifyActionMenu: set actions = root.actions.slice(1)
        NotifyActionButton->>NotifyActionMenu: open(actionButton)
        NotifyActionMenu-->>User: show menu
        User->>NotifyActionMenu: select menu item
        NotifyActionMenu->>NotifyActionMenu: onTriggered(modelData.id)
        NotifyActionMenu->>NotifyActionRoot: actionInvoked(modelData.id)
    else no_actionMenu
        NotifyActionButton->>NotifyActionButton: onClicked(actionData.id)
        NotifyActionButton->>NotifyActionRoot: actionInvoked(actionData.id)
    end
Loading

Class diagram for updated notification action components

classDiagram
    class NotifyActionRoot {
        <<QML_Control>>
        var actions
        void actionInvoked(var actionId)
        void gotoNextButton()
    }

    class NotifyActionButton {
        <<QML_Button>>
        var actionData
        var actionMenu
        string text
        bool enabled
        void onClicked()
    }

    class NotifyActionMenu {
        <<LP_Menu>>
        var actions
        actionInvoked(var actionId)
        void open(var anchorItem)
        void insertItem(int index, var item)
        void removeItem(var item)
    }

    NotifyActionRoot o-- NotifyActionButton : contains
    NotifyActionButton --> NotifyActionMenu : uses_actionMenu
    NotifyActionMenu --> NotifyActionRoot : emits_actionInvoked
Loading

File-Level Changes

Change Details Files
Replace ComboBox-based overflow actions UI with a button-driven menu to avoid text truncation and simplify sizing logic.
  • Removed ComboBox sourceComponent for additional notification actions including width measurement TextMetrics and popup sizing logic.
  • Introduced a NotifyActionButton instance bound to the second action (when present) to represent the overflow/"More" button.
  • Changed click handling so the overflow button opens a menu populated from the notification actions instead of relying on ComboBox selection.
panels/notification/plugin/NotifyAction.qml
Add a reusable NotifyActionMenu component based on Qt Labs Platform Menu and use it from the actions button.
  • Created NotifyActionMenu.qml implementing an LP.Menu with a dynamic actions property and Instantiator-based MenuItem population.
  • Emitted an actionInvoked signal from NotifyActionMenu when a menu item is triggered, passing the action id.
  • Connected NotifyActionButton.actionMenu to a NotifyActionMenu instance and forwarded its actionInvoked signal to the existing root.actionInvoked handler.
panels/notification/plugin/NotifyActionMenu.qml
panels/notification/plugin/NotifyAction.qml
Wire the new QML file into the notification plugin build and update licensing headers.
  • Added NotifyActionMenu.qml to the qt_add_qml_module notificationplugin source list.
  • Updated the SPDX-FileCopyrightText years for the notification plugin CMakeLists to cover 2024-2026.
  • Ensured the new menu component is installed with the notification plugin QML module.
panels/notification/plugin/CMakeLists.txt

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

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 - I've left some high level feedback:

  • In NotifyAction.qml, the menu for the "More" button is populated with root.actions.slice(1), which will include the same action already shown as the second NotifyActionButton; consider using slice(2) (or otherwise excluding the primary extra action) to avoid duplicate entries in the menu.
  • There are several console.log calls in the new menu and button click handlers that look like debugging output; consider removing or guarding them to avoid noisy logs in normal usage.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `NotifyAction.qml`, the menu for the "More" button is populated with `root.actions.slice(1)`, which will include the same action already shown as the second `NotifyActionButton`; consider using `slice(2)` (or otherwise excluding the primary extra action) to avoid duplicate entries in the menu.
- There are several `console.log` calls in the new menu and button click handlers that look like debugging output; consider removing or guarding them to avoid noisy logs in normal usage.

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, BLumia, 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

@18202781743 18202781743 merged commit 9861612 into linuxdeepin:master Mar 24, 2026
10 of 12 checks passed
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