Added horizontal padding to round buttons with full radius and width.
This commit is contained in:
parent
3a6708cdc5
commit
16f4aec946
1 changed files with 5 additions and 2 deletions
|
|
@ -332,11 +332,14 @@ void RoundButton::resizeToText(const QString &text) {
|
||||||
|
|
||||||
int innerWidth = contentWidth();
|
int innerWidth = contentWidth();
|
||||||
if (_fullWidthOverride > 0) {
|
if (_fullWidthOverride > 0) {
|
||||||
|
const auto padding = _fullRadius
|
||||||
|
? (_st.padding.left() + _st.padding.right())
|
||||||
|
: 0;
|
||||||
if (_fullWidthOverride < innerWidth + (_st.height - _st.font->height)) {
|
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);
|
_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) {
|
} else if (_fullWidthOverride < 0) {
|
||||||
resize(innerWidth - _fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom());
|
resize(innerWidth - _fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom());
|
||||||
} else if (_st.width <= 0) {
|
} else if (_st.width <= 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue