migrate pyqt5 to pyside6

This commit is contained in:
ykcheungab
2026-09-21 09:34:56 +08:00
parent e276b5de0f
commit ccedb9ddd9
66 changed files with 2184 additions and 395 deletions
+6 -6
View File
@@ -33,8 +33,8 @@ def _arrow_icon_cache_dir() -> Path:
def _paint_arrow(kind: str, fill: str) -> str:
"""Draw a small chevron PNG on demand; return its path ('' on failure)."""
try:
from PyQt5.QtCore import QPointF, Qt
from PyQt5.QtGui import QColor, QImage, QPainter, QPolygonF
from PySide6.QtCore import QPointF, Qt
from PySide6.QtGui import QColor, QImage, QPainter, QPolygonF
except Exception: # pragma: no cover - headless import failure
return ""
try:
@@ -43,12 +43,12 @@ def _paint_arrow(kind: str, fill: str) -> str:
path = _arrow_icon_cache_dir() / f"chevron_{kind}_{safe}.png"
if path.is_file():
return str(path)
image = QImage(size, size, QImage.Format_ARGB32)
image.fill(Qt.transparent)
image = QImage(size, size, QImage.Format.Format_ARGB32)
image.fill(Qt.GlobalColor.transparent)
painter = QPainter(image)
painter.setRenderHint(QPainter.Antialiasing, True)
painter.setRenderHint(QPainter.RenderHint.Antialiasing, True)
painter.setBrush(QColor(fill))
painter.setPen(Qt.NoPen)
painter.setPen(Qt.PenStyle.NoPen)
half = size / 2.0
top = size * 0.32
bottom = size * 0.68