mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Implement a way for editors to fit the label to the field.
This commit is contained in:
@@ -391,6 +391,23 @@ QWidget* PdmUiTreeSelectionEditor::createLabelWidget(QWidget * parent)
|
||||
return m_label;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QMargins PdmUiTreeSelectionEditor::calculateLabelContentMargins() const
|
||||
{
|
||||
QSize editorSize = m_textFilterLineEdit->sizeHint();
|
||||
QSize labelSize = m_label->sizeHint();
|
||||
int heightDiff = editorSize.height() - labelSize.height();
|
||||
QMargins contentMargins = m_label->contentsMargins();
|
||||
if (heightDiff > 0)
|
||||
{
|
||||
contentMargins.setTop(contentMargins.top() + heightDiff / 2);
|
||||
contentMargins.setBottom(contentMargins.bottom() + heightDiff / 2);
|
||||
}
|
||||
return contentMargins;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user