From 16f4aec946c12650299b7cad47543f22957f0444 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 23 Apr 2022 14:23:20 +0300 Subject: [PATCH] Added horizontal padding to round buttons with full radius and width. --- ui/widgets/buttons.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/widgets/buttons.cpp b/ui/widgets/buttons.cpp index 97f1c78..d2f5b4d 100644 --- a/ui/widgets/buttons.cpp +++ b/ui/widgets/buttons.cpp @@ -332,11 +332,14 @@ void RoundButton::resizeToText(const QString &text) { int innerWidth = contentWidth(); if (_fullWidthOverride > 0) { + const auto padding = _fullRadius + ? (_st.padding.left() + _st.padding.right()) + : 0; if (_fullWidthOverride < innerWidth + (_st.height - _st.font->height)) { - _text = _st.font->elided(text, qMax(_fullWidthOverride - (_st.height - _st.font->height), 1)); + _text = _st.font->elided(text, qMax(_fullWidthOverride - (_st.height - _st.font->height) - padding, 1)); _textWidth = _st.font->width(_text); } - resize(_fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom()); + resize(_fullWidthOverride + padding, _st.height + _st.padding.top() + _st.padding.bottom()); } else if (_fullWidthOverride < 0) { resize(innerWidth - _fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom()); } else if (_st.width <= 0) {