Add a more obvious placeholder icon (#1780)

This commit is contained in:
Veronica Berglyd Olsen
2024-03-27 12:32:55 +01:00
parent 1771dd2130
commit 3e66968387
3 changed files with 17 additions and 10 deletions
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m0 0v4l8 8-8 8v4h4l8-8 8 8h4v-4l-8-8 8-8v-4h-4l-8 8-8-8h-4z" fill="#f00" stroke-width=".70711"/>
</svg>

After

Width:  |  Height:  |  Size: 251 B

+7 -4
View File
@@ -544,6 +544,9 @@ class GuiIcons:
self._confName = "icons.conf"
self._iconPath = CONFIG.assetPath("icons")
# None Icon
self._noIcon = QIcon(str(self._iconPath / "none.svg"))
# Icon Theme Meta
self.themeName = ""
self.themeDescription = ""
@@ -680,7 +683,7 @@ class GuiIcons:
icon.addPixmap(pOne, QIcon.Mode.Normal, QIcon.State.On)
icon.addPixmap(pTwo, QIcon.Mode.Normal, QIcon.State.Off)
return icon
return QIcon()
return self._noIcon
def getPixmap(self, name: str, size: tuple[int, int]) -> QPixmap:
"""Return an icon from the icon buffer as a QPixmap. If it
@@ -712,7 +715,7 @@ class GuiIcons:
elif tLayout == nwItemLayout.NOTE:
iconName = "proj_note"
if iconName is None:
return QIcon()
return self._noIcon
return self.getIcon(iconName)
@@ -753,7 +756,7 @@ class GuiIcons:
"""
if name not in self.ICON_KEYS:
logger.error("Requested unknown icon name '%s'", name)
return QIcon()
return self._noIcon
# If we just want the app icons, return right away
if name == "novelwriter":
@@ -769,7 +772,7 @@ class GuiIcons:
# If we didn't find one, give up and return an empty icon
logger.warning("Did not load an icon for '%s'", name)
return QIcon()
return self._noIcon
# END Class GuiIcons