Fix theme/checkboxes when path contains an apostrophe

I couldn't find a list of other characters we might need to handle too.
I tested with ", but Qt failed to start then.

https://forums.ankiweb.net/t/qt-rendering-bug-in-check-boxes/66196
This commit is contained in:
Damien Elmes 2025-09-02 15:55:18 +10:00
parent 157da4c7a7
commit 01b825f7c6

View file

@ -115,7 +115,7 @@ class ThemeManager:
# Workaround for Qt bug. First attempt was percent-escaping the chars, # Workaround for Qt bug. First attempt was percent-escaping the chars,
# but Qt can't handle that. # but Qt can't handle that.
# https://forum.qt.io/topic/55274/solved-qss-with-special-characters/11 # https://forum.qt.io/topic/55274/solved-qss-with-special-characters/11
path = re.sub(r"([\u00A1-\u00FF])", r"\\\1", path) path = re.sub(r"(['\u00A1-\u00FF])", r"\\\1", path)
return path return path
def icon_from_resources(self, path: str | ColoredIcon) -> QIcon: def icon_from_resources(self, path: str | ColoredIcon) -> QIcon: