From 9497ff47c0e9302b9afac06d5bb3b1fcb42584e0 Mon Sep 17 00:00:00 2001 From: gongheng Date: Sat, 9 May 2026 14:48:55 +0800 Subject: [PATCH] fix(shortcuts): display correct group name for each shortcut type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded "Settings" group name with type-specific names (Settings, File, Display, Tools, Edit) based on ShortCutType enum. 修复快捷键分组名称硬编码为"Settings"的bug,根据ShortCutType枚举 正确显示对应的分组名称。 Log: 修复快捷键分组名称显示错误 Bug: https://pms.uniontech.com/bug-view-354843.html Influence: 快捷键列表中各分组将显示正确的名称,不再统一显示为"Settings"。 --- reader/widgets/ShortCutShow.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/reader/widgets/ShortCutShow.cpp b/reader/widgets/ShortCutShow.cpp index c7d9d2b9..9875003b 100644 --- a/reader/widgets/ShortCutShow.cpp +++ b/reader/widgets/ShortCutShow.cpp @@ -1,5 +1,4 @@ -// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -57,17 +56,26 @@ void ShortCutShow::show() for(ShortCutType type : listType) { QJsonObject group; - group.insert("groupName", tr("Settings")); - QJsonArray items; + QString strType; + switch (type) { + case ShortCutType::Settings: strType = tr("Settings"); break; + case ShortCutType::File: strType = tr("File"); break; + case ShortCutType::Display: strType = tr("Display"); break; + case ShortCutType::Tools: strType = tr("Tools"); break; + case ShortCutType::Edit: strType = tr("Edit"); break; + } + group.insert("groupName", strType); + + QJsonArray items; for (const auto &d : m_shortcutMap[type]) { QJsonObject jsonItem; jsonItem.insert("name", d.second); jsonItem.insert("value", d.first); items.append(jsonItem); } - group.insert("groupItems", items); + jsonGroups.append(group); }