JSON Wizards: Give labels more space even when word-wrapped

QLabel has a horizontal size policy of "Preferred", but if the label is
word-wrapped, the sizeHint is a using a golden ratio for width & height,
but we want the label to grab as much horizontal space as it gets
anyhow.

Change-Id: I6ed049f4f23158014dc04f2d5020b7c2dd4c1980
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2019-04-04 14:03:30 +02:00
parent 86b1376e5c
commit 788ef20247

View File

@@ -388,6 +388,7 @@ QWidget *LabelField::createWidget(const QString &displayName, JsonFieldPage *pag
auto w = new QLabel;
w->setWordWrap(m_wordWrap);
w->setText(m_text);
w->setSizePolicy(QSizePolicy::Expanding, w->sizePolicy().verticalPolicy());
return w;
}