70 lines
2.7 KiB
Diff
70 lines
2.7 KiB
Diff
From f6d26e5eae0bdc8f3e37b83caea40c750d5166a2 Mon Sep 17 00:00:00 2001
|
|
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
|
Date: Thu, 18 Apr 2024 16:57:29 +0800
|
|
Subject: [PATCH 6/7] fix(search): Adjusting the display style of manually
|
|
registered search keywords and subfunctional keywords
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 调整手动注册搜索关键字和子功能关键字显示样式
|
|
|
|
Closes #35340,#35278
|
|
---
|
|
src/search-edit/search-model.cpp | 22 +++++++++++++++-------
|
|
1 file changed, 15 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/search-edit/search-model.cpp b/src/search-edit/search-model.cpp
|
|
index 7c5a6f0..6afcffe 100644
|
|
--- a/src/search-edit/search-model.cpp
|
|
+++ b/src/search-edit/search-model.cpp
|
|
@@ -51,6 +51,16 @@ void SearchModel::loadSearchModel()
|
|
|
|
auto subitems = category->getSubItems();
|
|
|
|
+ if(subitems.size() > 0)
|
|
+ {
|
|
+ // 添加分类搜索项
|
|
+ appendItem(categoryName, categoryID, subitems.at(0)->getID());
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * NOTE: 分类下单个子功能项应不添加搜索项
|
|
+ * 避免 显示设置分类下显示设置子功能项,构成"显示设置->显示设置"这种搜索项
|
|
+ */
|
|
bool addSubItemNamePrefix = true;
|
|
if (subitems.size() == 1)
|
|
{
|
|
@@ -65,15 +75,13 @@ void SearchModel::loadSearchModel()
|
|
QString subItemPrefix;
|
|
if (addSubItemNamePrefix)
|
|
{
|
|
- QString searchText = QString("%1 -> %2").arg(categoryName).arg(subitemName);
|
|
- appendItem(searchText, categoryID, subitemID);
|
|
- subItemPrefix = searchText;
|
|
+ QString subItemSearchKey = QString("%1 -> %2").arg(categoryName).arg(subitemName);
|
|
+ appendItem(subItemSearchKey, categoryID, subitemID);
|
|
+ subItemPrefix = subItemSearchKey;
|
|
}
|
|
else
|
|
{
|
|
- QString searchText = categoryName;
|
|
- appendItem(searchText, categoryID, subitemID);
|
|
- subItemPrefix = searchText;
|
|
+ subItemPrefix = categoryName;
|
|
}
|
|
|
|
auto searchItems = subitem->getSearchKeys();
|
|
@@ -81,7 +89,7 @@ void SearchModel::loadSearchModel()
|
|
{
|
|
QString searchName = searchItem.first;
|
|
QString searchKey = searchItem.second;
|
|
- QString searchText = QString("%1 : %2").arg(subItemPrefix).arg(searchName);
|
|
+ QString searchText = QString("%1 -> %2").arg(subItemPrefix).arg(searchName);
|
|
appendItem(searchText, categoryID, subitemID, searchKey);
|
|
}
|
|
}
|
|
--
|
|
2.33.0
|
|
|