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:
parent
f36c38533b
commit
72052377dc
@ -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;
|
||||
setDisplayText(text);
|
||||
|
||||
if (textHasChanged)
|
||||
{
|
||||
adjustSize();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -168,5 +175,5 @@ void caf::QShortenedLabel::resizeText(QSize paintSize)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void QShortenedLabel::setDisplayText(const QString& displayText)
|
||||
{
|
||||
QLabel::setText(displayText);
|
||||
QLabel::setText(displayText);
|
||||
}
|
||||
|
@ -90,8 +90,18 @@ bool caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingIn
|
||||
QWidget* containerWidget,
|
||||
const QString& uiConfigName)
|
||||
{
|
||||
QSize beforeSize = containerWidget->sizeHint();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user