Utils: Fix setting of minimal height of InfoLabels in QFormLayout

Calling setMinimumHeight is not compatible with QFormLayout if the label
has multiple lines. Overriding minimumSizeHint on the other hand is.

Change-Id: Id2167b295620322cec75035d7cc7125cc3221c4d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2019-12-21 22:58:24 +01:00
parent e34263853c
commit 25323be13d
3 changed files with 16 additions and 1 deletions

View File

@@ -45,7 +45,6 @@ InfoLabel::InfoLabel(const QString &text, InfoType type, QWidget *parent)
: ElidingLabel(text, parent)
{
setType(type);
setMinimumHeight(iconSize);
}
InfoLabel::InfoType InfoLabel::type() const
@@ -70,6 +69,13 @@ void InfoLabel::setFilled(bool filled)
m_filled = filled;
}
QSize InfoLabel::minimumSizeHint() const
{
QSize baseHint = ElidingLabel::minimumSizeHint();
baseHint.setHeight(qMax(baseHint.height(), iconSize));
return baseHint;
}
static Utils::Theme::Color fillColorForType(InfoLabel::InfoType type)
{
using namespace Utils;