vcl/source/control/button.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit c66de7079f5ad92889a28b4a3f18adc4c4cf019f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue May 18 16:34:22 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue May 18 20:17:15 2021 +0200 tdf#142337 Button::GetOptimalSize only considered image beside text case not image above/below text Change-Id: I5a8e9bfb36cee1460d43478a100e574a3bf1930e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115758 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 42d3da20c2a2..1e47b8fbba35 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1629,8 +1629,21 @@ Size PushButton::CalcMinimumSize() const { Size textSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ), PushButton::GetText(), ImplGetTextStyle( DrawFlags::NONE ) ).GetSize(); - aSize.AdjustWidth(textSize.Width() ); - aSize.setHeight( std::max( aSize.Height(), tools::Long( textSize.Height() * 1.15 ) ) ); + + tools::Long nTextHeight = textSize.Height() * 1.15; + + ImageAlign eImageAlign = GetImageAlign(); + // tdf#142337 only considering the simple top/bottom/left/right possibilities + if (eImageAlign == ImageAlign::Top || eImageAlign == ImageAlign::Bottom) + { + aSize.AdjustHeight(nTextHeight); + aSize.setWidth(std::max(aSize.Width(), textSize.Width())); + } + else + { + aSize.AdjustWidth(textSize.Width()); + aSize.setHeight(std::max(aSize.Height(), nTextHeight)); + } } // cf. ImplDrawPushButton ... _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits