From 5f1848b26a1a528c770bcd33ed17cb839ed3ed50 Mon Sep 17 00:00:00 2001 From: shen Date: Tue, 30 Jun 2026 08:43:29 +0800 Subject: [PATCH] Refine thumbnail and status controls --- README.md | 4 ++-- docs/development_plan.md | 4 ++-- pdfreaderlite/ui/main_window.py | 27 +++++++++++++-------------- pdfreaderlite/ui/sidebar.py | 5 +++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4f2b2a2..76e1255 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,8 @@ PDFReaderLite 是一个面向 Windows 的轻量 PDF 阅读与编辑工具,目 - exe 版本资源 - 设置中注册 PDF 文件关联 - Acrobat 风格右侧工具面板(已完成可折叠分类、搜索结果默认收起、整栏收起/展开) -- 缩略图单列卡片式显示与克制选中态,支持随左侧栏拖拽宽度自适应缩放 -- 顶部与右侧常用工具图标化,另存为/缩放/适应宽度图标已区分 +- 缩略图单列卡片式显示与克制选中态,支持随左侧栏拖拽宽度自适应缩放并限制最大栏宽 +- 顶部与右侧常用工具图标化,另存为/缩放/适应宽度图标已区分,状态栏页面按钮已加宽 - 图片签名 - 多标签页打开、切换、关闭 PDF - 未保存更改星号提示,关闭标签/窗口时保存确认 diff --git a/docs/development_plan.md b/docs/development_plan.md index b109ce0..ebeb41d 100644 --- a/docs/development_plan.md +++ b/docs/development_plan.md @@ -65,8 +65,8 @@ PDFReaderLite 是 Windows 平台的轻量 PDF 阅读与编辑工具。功能重 - 大文件性能优化(已完成缩略图可见区域懒加载与缩略图独立缓存) - Acrobat 风格右侧工具面板(已完成可折叠分类、搜索结果默认收起、整栏收起/展开) -- 缩略图单列卡片式显示与克制选中态(已完成随左侧栏拖拽宽度自适应缩放) -- 顶部与右侧常用工具图标化(已完成另存为、缩小、放大、适应宽度图标区分) +- 缩略图单列卡片式显示与克制选中态(已完成随左侧栏拖拽宽度自适应缩放,并限制最大栏宽) +- 顶部与右侧常用工具图标化(已完成另存为、缩小、放大、适应宽度图标区分,状态栏页面按钮已加宽) - 页面缓存(已完成基础缓存) - 后台渲染(已完成缩略图分批加载) - 快捷键(已完成常用快捷键与说明) diff --git a/pdfreaderlite/ui/main_window.py b/pdfreaderlite/ui/main_window.py index 12af41c..5548dc1 100644 --- a/pdfreaderlite/ui/main_window.py +++ b/pdfreaderlite/ui/main_window.py @@ -1097,12 +1097,9 @@ class MainWindow(QMainWindow): painter = QPainter(pixmap) painter.setRenderHint(QPainter.RenderHint.Antialiasing) pen_color = color or QColor("#2d73c5") - painter.setPen(QPen(pen_color, 2)) - painter.setBrush(Qt.BrushStyle.NoBrush) - painter.drawRoundedRect(3, 3, 18, 18, 4, 4) font = QFont() font.setBold(True) - font.setPixelSize(12 if len(text) <= 1 else 9) + font.setPixelSize(18 if len(text) <= 1 else 13) painter.setFont(font) painter.setPen(pen_color) painter.drawText(pixmap.rect(), Qt.AlignmentFlag.AlignCenter, text) @@ -1293,12 +1290,14 @@ class MainWindow(QMainWindow): toolbar.addSeparator() toolbar.addAction(self.toggle_tools_action) - def _status_action_button(self, action: QAction) -> QToolButton: + def _status_action_button(self, action: QAction, width: int = 64) -> QToolButton: button = QToolButton() button.setObjectName("statusToolButton") button.setDefaultAction(action) - button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) - button.setIconSize(QSize(16, 16)) + button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + button.setIconSize(QSize(20, 20)) + button.setMinimumWidth(width) + button.setMinimumHeight(24) button.setAutoRaise(True) return button @@ -1326,13 +1325,13 @@ class MainWindow(QMainWindow): for widget in [ zoom_label, - self._status_action_button(self.zoom_out_action), - self._status_action_button(self.zoom_in_action), + self._status_action_button(self.zoom_out_action, 66), + self._status_action_button(self.zoom_in_action, 66), self.zoom_slider, self.zoom_percent_input, - self._status_action_button(self.fit_width_action), - self._status_action_button(self.fit_page_action), - self._status_action_button(self.go_to_page_action), + self._status_action_button(self.fit_width_action, 92), + self._status_action_button(self.fit_page_action, 92), + self._status_action_button(self.go_to_page_action, 66), ]: status.addPermanentWidget(widget) @@ -1912,7 +1911,7 @@ class MainWindow(QMainWindow): QLabel#statusZoomLabel { color: #cfd3d8; padding: 0 4px 0 10px; } QToolButton#statusToolButton { color: #f1f1f1; background: transparent; border: 1px solid transparent; - border-radius: 4px; padding: 3px; + border-radius: 4px; padding: 3px 7px; } QToolButton#statusToolButton:hover { background: #3c4045; border-color: #555a60; } QLineEdit, QSpinBox { @@ -1985,7 +1984,7 @@ class MainWindow(QMainWindow): QLabel#statusZoomLabel { color: #5b6067; padding: 0 4px 0 10px; } QToolButton#statusToolButton { color: #25272a; background: transparent; border: 1px solid transparent; - border-radius: 4px; padding: 3px; + border-radius: 4px; padding: 3px 7px; } QToolButton#statusToolButton:hover { background: #eceff3; border-color: #c9cdd3; } QLineEdit, QSpinBox { diff --git a/pdfreaderlite/ui/sidebar.py b/pdfreaderlite/ui/sidebar.py index 32d797b..347e867 100644 --- a/pdfreaderlite/ui/sidebar.py +++ b/pdfreaderlite/ui/sidebar.py @@ -11,6 +11,7 @@ from pdfreaderlite.core.document import PdfDocument class ThumbnailList(QListWidget): page_selected = Signal(int) + MAX_THUMBNAIL_WIDTH = 170 def __init__(self) -> None: super().__init__() @@ -38,7 +39,7 @@ class ThumbnailList(QListWidget): def _update_thumbnail_metrics(self) -> None: viewport_width = max(120, self.viewport().width()) - thumbnail_width = max(92, min(170, viewport_width - 34)) + thumbnail_width = max(92, min(self.MAX_THUMBNAIL_WIDTH, viewport_width - 34)) thumbnail_height = int(thumbnail_width * 1.34) gap = max(2, round(self.fontMetrics().height() * 0.5)) label_height = self.fontMetrics().height() + 8 @@ -143,7 +144,7 @@ class Sidebar(QTabWidget): self.addTab(thumb_page, "缩略图") self.setMinimumWidth(150) - self.setMaximumWidth(340) + self.setMaximumWidth(224) def load_document(self, document: PdfDocument) -> None: self.thumbnails.load_document(document)