Refine thumbnail and status controls

This commit is contained in:
2026-06-30 08:43:29 +08:00
parent 6feedf58ef
commit 5f1848b26a
4 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -68,8 +68,8 @@ PDFReaderLite 是一个面向 Windows 的轻量 PDF 阅读与编辑工具,目
- exe 版本资源
- 设置中注册 PDF 文件关联
- Acrobat 风格右侧工具面板(已完成可折叠分类、搜索结果默认收起、整栏收起/展开)
- 缩略图单列卡片式显示与克制选中态,支持随左侧栏拖拽宽度自适应缩放
- 顶部与右侧常用工具图标化,另存为/缩放/适应宽度图标已区分
- 缩略图单列卡片式显示与克制选中态,支持随左侧栏拖拽宽度自适应缩放并限制最大栏宽
- 顶部与右侧常用工具图标化,另存为/缩放/适应宽度图标已区分,状态栏页面按钮已加宽
- 图片签名
- 多标签页打开、切换、关闭 PDF
- 未保存更改星号提示,关闭标签/窗口时保存确认
+2 -2
View File
@@ -65,8 +65,8 @@ PDFReaderLite 是 Windows 平台的轻量 PDF 阅读与编辑工具。功能重
- 大文件性能优化(已完成缩略图可见区域懒加载与缩略图独立缓存)
- Acrobat 风格右侧工具面板(已完成可折叠分类、搜索结果默认收起、整栏收起/展开)
- 缩略图单列卡片式显示与克制选中态(已完成随左侧栏拖拽宽度自适应缩放)
- 顶部与右侧常用工具图标化(已完成另存为、缩小、放大、适应宽度图标区分)
- 缩略图单列卡片式显示与克制选中态(已完成随左侧栏拖拽宽度自适应缩放,并限制最大栏宽)
- 顶部与右侧常用工具图标化(已完成另存为、缩小、放大、适应宽度图标区分,状态栏页面按钮已加宽)
- 页面缓存(已完成基础缓存)
- 后台渲染(已完成缩略图分批加载)
- 快捷键(已完成常用快捷键与说明)
+13 -14
View File
@@ -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 {
+3 -2
View File
@@ -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)