mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Implement a way for editors to fit the label to the field.
This commit is contained in:
1 parent
2e5310bf38
commit
8c5e538f01
9 files changed
+90
-23
No files matched your search
@@ -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