mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for QIcon::isNull() return False even though there are no available sizes
This commit is contained in:
parent
2d76098a19
commit
d0364c9635
@ -79,7 +79,7 @@ def get_icons(zfp, name_or_list_of_names, plugin_name=''):
|
||||
if plugin_name:
|
||||
for name in namelist:
|
||||
q = QIcon.ic(f'{plugin_name}/{name}')
|
||||
if q.isNull():
|
||||
if q.isNull() or not tuple(q.availableSizes()):
|
||||
failed.add(name)
|
||||
else:
|
||||
ans[name] = q
|
||||
|
@ -167,11 +167,11 @@ class IconResourceManager:
|
||||
return QIcon(q)
|
||||
icon_name = os.path.splitext(name.replace('\\', '__').replace('/', '__'))[0]
|
||||
ans = QIcon.fromTheme(icon_name)
|
||||
if ans.isNull():
|
||||
if ans.isNull() and not tuple(ans.availableSizes()):
|
||||
if 'user-any' in QIcon.themeName():
|
||||
tc = 'dark' if QApplication.instance().is_dark_theme else 'light'
|
||||
q = QIcon(f':/icons/calibre-default-{tc}/images/{name}')
|
||||
if not q.isNull():
|
||||
if not q.isNull() and tuple(q.availableSizes()):
|
||||
ans = q
|
||||
return ans
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user