Added ability to provide align of text to IconButtonWithText.
This commit is contained in:
parent
289bcf50e9
commit
50ef072af7
2 changed files with 3 additions and 2 deletions
|
|
@ -24,13 +24,13 @@ void IconButtonWithText::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
p.setFont(_st.font);
|
p.setFont(_st.font);
|
||||||
p.setPen(_st.textFg);
|
p.setPen(_st.textFg);
|
||||||
p.drawText(r, _text, style::al_center);
|
p.drawText(r, _text, _st.textAlign);
|
||||||
|
|
||||||
const auto overIconOpacity = IconButton::iconOverOpacity();
|
const auto overIconOpacity = IconButton::iconOverOpacity();
|
||||||
if (overIconOpacity > 0. && overIconOpacity < 1.) {
|
if (overIconOpacity > 0. && overIconOpacity < 1.) {
|
||||||
p.setPen(_st.textFgOver);
|
p.setPen(_st.textFgOver);
|
||||||
p.setOpacity(overIconOpacity);
|
p.setOpacity(overIconOpacity);
|
||||||
p.drawText(r, _text, style::al_center);
|
p.drawText(r, _text, _st.textAlign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,7 @@ IconButtonWithText {
|
||||||
textFg: color;
|
textFg: color;
|
||||||
textFgOver: color;
|
textFgOver: color;
|
||||||
textPadding: margins;
|
textPadding: margins;
|
||||||
|
textAlign: align;
|
||||||
|
|
||||||
font: font;
|
font: font;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue