修复若干bug

This commit is contained in:
2026-04-03 22:48:27 +08:00
parent 10843a5bc5
commit 17655f2dba
16 changed files with 108 additions and 2 deletions
+13 -1
View File
@@ -858,6 +858,16 @@ class PanelWindow(QWidget):
)
self.groups_layout.insertWidget(self.groups_layout.count() - 1, gw)
def reset_groups_and_items(self):
"""清空所有分组与程序,并刷新界面。"""
database.reset_groups_and_items(recreate_default_group=True)
# 清空搜索关键字,确保刷新后可见全部内容
try:
self.search_box.setText("")
except Exception:
pass
self.refresh_groups()
def _add_group(self):
name, ok = dialog_style.get_text(self, "新建分组", "分组名称:")
if ok and name.strip():
@@ -909,12 +919,13 @@ class PanelWindow(QWidget):
def _collapse_body(self):
"""收缩:隐藏内容区,窗口缩到只剩标题栏高度"""
self._body.hide()
self.weather_bar.hide()
# 记录当前高度,展开时恢复
self._expanded_height = self.height()
title_h = (
self.container.layout().contentsMargins().top()
+ self.container.layout().contentsMargins().bottom()
+ 46
+ self._title_bar.sizeHint().height()
)
self.setFixedHeight(title_h)
ic = "#cccccc" if theme.name() == "dark" else "#555555"
@@ -923,6 +934,7 @@ class PanelWindow(QWidget):
def _expand_body(self):
"""展开:恢复内容区和窗口高度"""
self.weather_bar.show()
self._body.show()
h = getattr(self, "_expanded_height", 520)
self.setMinimumHeight(MIN_H)