DolphinQt: Fix ElidedButton (MappingButton) from growing with long text.

This commit is contained in:
Jordan Woyak
2019-03-03 08:05:59 -06:00
parent 2a3c075330
commit 1cae9b9b39
3 changed files with 17 additions and 12 deletions

View File

@ -27,6 +27,14 @@ void ElidedButton::setElideMode(Qt::TextElideMode elide_mode)
repaint();
}
QSize ElidedButton::sizeHint() const
{
// Long text produces big sizeHints which is throwing layouts off
// even when setting fixed sizes. This seems like a Qt layout bug.
// Let's always return the sizeHint of an empty button to work around this.
return QPushButton(parentWidget()).sizeHint();
}
void ElidedButton::paintEvent(QPaintEvent* event)
{
QStyleOptionButton option;