mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4305 Adjust size of layouts and labels if the sizeHint has changed
This commit is contained in:
@@ -53,10 +53,17 @@ QShortenedLabel::QShortenedLabel(QWidget* parent /*= nullptr*/, Qt::WindowFlags
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void caf::QShortenedLabel::setText(const QString& text)
|
void QShortenedLabel::setText(const QString& text)
|
||||||
{
|
{
|
||||||
|
bool textHasChanged = m_fullLengthText != text;
|
||||||
|
|
||||||
m_fullLengthText = text;
|
m_fullLengthText = text;
|
||||||
setDisplayText(text);
|
setDisplayText(text);
|
||||||
|
|
||||||
|
if (textHasChanged)
|
||||||
|
{
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -90,8 +90,18 @@ bool caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
|||||||
QWidget* containerWidget,
|
QWidget* containerWidget,
|
||||||
const QString& uiConfigName)
|
const QString& uiConfigName)
|
||||||
{
|
{
|
||||||
|
QSize beforeSize = containerWidget->sizeHint();
|
||||||
|
|
||||||
ensureWidgetContainsEmptyGridLayout(containerWidget);
|
ensureWidgetContainsEmptyGridLayout(containerWidget);
|
||||||
return recursivelyConfigureAndUpdateUiOrderingInGridLayout(uiOrdering, containerWidget, uiConfigName);
|
int stretch = recursivelyConfigureAndUpdateUiOrderingInGridLayout(uiOrdering, containerWidget, uiConfigName);
|
||||||
|
|
||||||
|
QSize afterSize = containerWidget->sizeHint();
|
||||||
|
if (beforeSize != afterSize)
|
||||||
|
{
|
||||||
|
containerWidget->adjustSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
return stretch > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user