Whenever the width of a text exceeds the width of the Button itself, the font size will be stepwise decreased till the text fits the button. This stepwise shrinking was done by assigning the font in each step and checking the resulting proportions.
Setting the font of a widget more than once, however, seems to mark it dirty and triggers rerendering. Since Button::updateFont() is called as part of Button::paintEvent() we will get ourselves trapped in an infinite loop.
Surprisingly, this was not triggered unless one uses one of the more outdated translations. And even more surprisingly this seems to not result in any bad behavior other than Qt being unable to open the native File browser on Linux (in a native build. AppImages were not affected).
The same fix was applied to ClickableLabel to assure we won't get into trouble there either.
Whenever the width of a text exceeds the width of the
Button
itself, the font size will be stepwise decreased till the text fits the button. This stepwise shrinking was done by assigning the font in each step and checking the resulting proportions.Setting the font of a widget more than once, however, seems to mark it dirty and triggers rerendering. Since
Button::updateFont()
is called as part ofButton::paintEvent()
we will get ourselves trapped in an infinite loop.Surprisingly, this was not triggered unless one uses one of the more outdated translations. And even more surprisingly this seems to not result in any bad behavior other than Qt being unable to open the native File browser on Linux (in a native build. AppImages were not affected).
The same fix was applied to
ClickableLabel
to assure we won't get into trouble there either.Fixes https://github.com/hydrogen-music/hydrogen/issues/1908