The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(main_window): DropOverlay 用 IconWidget + SubtitleLabel 替代 QPainter 绘制文字
XiaoYouChR57430cae49eb
diff --git a/app/view/windows/main_window.py b/app/view/windows/main_window.pyindex 699481bc..b7a20339 100644--- a/app/view/windows/main_window.py+++ b/app/view/windows/main_window.py@@ -6,10 +6,10 @@ from typing import TYPE_CHECKINGfrom PySide6.QtCore import QEvent, QRect, QUrl, QTimer, Qtfrom PySide6.QtGui import QColor, QIcon, QDesktopServices, QPainter, QPalette-from PySide6.QtWidgets import QApplication, QHBoxLayout, QWidget+from PySide6.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QWidgetfrom qfluentwidgets import (MSFluentWindow, FluentIcon, NavigationItemPosition, MessageBox, Theme, InfoBar, InfoBarPosition,- SearchLineEdit, setThemeColor,+ SearchLineEdit, setThemeColor, IconWidget, SubtitleLabel, isDarkTheme,)from app.config.cfg import CloseMode, cfg@@ -37,33 +37,32 @@ class DropOverlay(QWidget):def __init__(self, parent=None):super().__init__(parent)self._initWidget()+ self._initLayout()def _initWidget(self):self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)++ self._icon = IconWidget(FluentIcon.FOLDER_ADD, self)+ self._icon.setFixedSize(48, 48)+ self._icon.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)++ self._label = SubtitleLabel(self.tr("松开以添加任务"), self)+ self._label.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)+self.hide()+ def _initLayout(self):+ layout = QVBoxLayout(self)+ layout.setAlignment(Qt.AlignmentFlag.AlignCenter)+ layout.addWidget(self._icon, 0, Qt.AlignmentFlag.AlignCenter)+ layout.addSpacing(8)+ layout.addWidget(self._label, 0, Qt.AlignmentFlag.AlignCenter)+def paintEvent(self, event):- from qfluentwidgets import isDarkThemepainter = QPainter(self)- painter.setRenderHint(QPainter.RenderHint.Antialiasing)-bgColor = QColor(0, 0, 0, 128) if isDarkTheme() else QColor(255, 255, 255, 180)painter.fillRect(self.rect(), bgColor)- cx, cy = self.width() // 2, self.height() // 2- iconSize = 48- iconRect = QRect(cx - iconSize // 2, cy - iconSize - 4, iconSize, iconSize)- FluentIcon.FOLDER_ADD.render(painter, iconRect)-- textColor = QColor(255, 255, 255, 200) if isDarkTheme() else QColor(0, 0, 0, 180)- painter.setPen(textColor)- font = self.font()- font.setPixelSize(16)- painter.setFont(font)- textRect = QRect(0, cy + 4, self.width(), 30)- painter.drawText(textRect, Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignTop,- self.tr("松开以添加任务"))-class MainWindow(MSFluentWindow):