Fix donate button being rendered as a blank when toolbar icons are turned off

This does mean that there will be one icon on the toolbar always (unless
the donate button is removed).
This commit is contained in:
Kovid Goyal 2022-06-26 11:26:19 +05:30
parent 874507efec
commit 3a152fe2b2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -704,6 +704,6 @@ class BarsManager(QObject):
for bar in self.bars: for bar in self.bars:
bar.setIconSize(QSize(sz, sz)) bar.setIconSize(QSize(sz, sz))
bar.setToolButtonStyle(style) bar.setToolButtonStyle(style)
if bar.showing_donate: if bar.donate_button:
bar.donate_button.setIconSize(bar.iconSize()) bar.donate_button.setIconSize(bar.iconSize())
bar.donate_button.setToolButtonStyle(style) bar.donate_button.setToolButtonStyle(style)

View File

@ -56,6 +56,8 @@ class ThrobbingButton(QToolButton):
if self.animation.state() != QAbstractAnimation.State.Stopped or not self.isVisible(): if self.animation.state() != QAbstractAnimation.State.Stopped or not self.isVisible():
return return
size = self.iconSize().width() size = self.iconSize().width()
if size < 1:
size = max(0, self.width() - 4)
smaller = int(0.7 * size) smaller = int(0.7 * size)
self.animation.setStartValue(smaller) self.animation.setStartValue(smaller)
self.animation.setEndValue(size) self.animation.setEndValue(size)
@ -67,6 +69,7 @@ class ThrobbingButton(QToolButton):
def paintEvent(self, ev): def paintEvent(self, ev):
size = self._icon_size if self._icon_size > 10 else self.iconSize().width() size = self._icon_size if self._icon_size > 10 else self.iconSize().width()
size = size or max(0, self.width() - 4)
p = QPainter(self) p = QPainter(self)
opt = QStyleOptionToolButton() opt = QStyleOptionToolButton()
self.initStyleOption(opt) self.initStyleOption(opt)