Added ability to provide align of text to IconButtonWithText.

This commit is contained in:
23rd 2022-04-19 17:12:15 +03:00
parent 289bcf50e9
commit 50ef072af7
2 changed files with 3 additions and 2 deletions

View file

@ -24,13 +24,13 @@ void IconButtonWithText::paintEvent(QPaintEvent *e) {
Painter p(this);
p.setFont(_st.font);
p.setPen(_st.textFg);
p.drawText(r, _text, style::al_center);
p.drawText(r, _text, _st.textAlign);
const auto overIconOpacity = IconButton::iconOverOpacity();
if (overIconOpacity > 0. && overIconOpacity < 1.) {
p.setPen(_st.textFgOver);
p.setOpacity(overIconOpacity);
p.drawText(r, _text, style::al_center);
p.drawText(r, _text, _st.textAlign);
}
}

View file

@ -345,6 +345,7 @@ IconButtonWithText {
textFg: color;
textFgOver: color;
textPadding: margins;
textAlign: align;
font: font;
}