From a562804a68ad16055a2fbc3cdab6cb787a186f0a Mon Sep 17 00:00:00 2001 From: Lesacm <1500309685@qq.com> Date: Mon, 27 Oct 2025 10:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8UI=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/word_style_ui.py | 59 ----------------------------------------- src/word_main_window.py | 6 +---- 2 files changed, 1 insertion(+), 64 deletions(-) diff --git a/src/ui/word_style_ui.py b/src/ui/word_style_ui.py index 0716239..e694b2c 100644 --- a/src/ui/word_style_ui.py +++ b/src/ui/word_style_ui.py @@ -530,65 +530,6 @@ class WordTextEdit(QTextEdit): # 设置光标宽度 self.setCursorWidth(2) -class WordStyleToolBar(QToolBar): - def __init__(self, parent=None): - super().__init__(parent) - self.setup_ui() - - def setup_ui(self): - """设置快速访问工具栏""" - self.setFixedHeight(30) - self.setStyleSheet(""" - QToolBar { - background-color: #f3f2f1; - border-bottom: 1px solid #d0d0d0; - spacing: 5px; - } - """) - - # 快速访问按钮 - save_btn = self.create_quick_button("保存", "Ctrl+S") - undo_btn = self.create_quick_button("撤销", "Ctrl+Z") - redo_btn = self.create_quick_button("重做", "Ctrl+Y") - - self.addWidget(save_btn) - self.addWidget(undo_btn) - self.addWidget(redo_btn) - self.addSeparator() - - # 添加弹性空间,将后面的按钮推到最右侧 - # 创建一个具有扩展策略的QWidget来实现spacer效果 - spacer = QWidget() - spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) - self.addWidget(spacer) - - # 添加批注、编辑、共享按钮到最右侧 - comment_btn = self.create_quick_button("批注", "") - edit_btn = self.create_quick_button("编辑", "") - share_btn = self.create_quick_button("共享", "") - - self.addWidget(comment_btn) - self.addWidget(edit_btn) - self.addWidget(share_btn) - - def create_quick_button(self, text, shortcut): - """创建快速访问按钮""" - btn = QToolButton() - btn.setText(text) - btn.setToolButtonStyle(Qt.ToolButtonTextOnly) - btn.setFixedSize(40, 25) - btn.setStyleSheet(""" - QToolButton { - border: none; - background-color: transparent; - font-size: 11px; - color: #333333; - } - QToolButton:hover { - background-color: #e1e1e1; - } - """) - return btn class WeatherAPI: def __init__(self): self.api_key = "f3d9201bf5974ed39caf0d6fe9567322" diff --git a/src/word_main_window.py b/src/word_main_window.py index dbf3ffc..41b49b8 100644 --- a/src/word_main_window.py +++ b/src/word_main_window.py @@ -10,7 +10,7 @@ from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, QRect, QByteArray, QBu from PyQt5.QtGui import QFont, QPalette, QColor, QIcon, QPixmap, QTextCharFormat, QTextCursor, QTextDocument, QImage, QTextImageFormat, QTextFormat from ui.word_style_ui import (WordRibbon, WordStatusBar, WordTextEdit, - WordStyleToolBar) + ) from services.network_service import NetworkService from typing_logic import TypingLogic from ui.word_style_ui import WeatherAPI @@ -213,10 +213,6 @@ class WordStyleMainWindow(QMainWindow): # 创建菜单栏 self.create_menu_bar() - # 创建快速访问工具栏 - self.quick_toolbar = WordStyleToolBar() - self.addToolBar(Qt.TopToolBarArea, self.quick_toolbar) - # 创建Ribbon功能区 self.ribbon = WordRibbon()