Show poll's multiple answer radios as checkboxes
This commit is contained in:
parent
6f5e0b051a
commit
9ee1e4347b
1 changed files with 19 additions and 3 deletions
|
|
@ -1168,8 +1168,12 @@ void Poll::paintRadio(
|
|||
auto pen = regular->p;
|
||||
pen.setWidth(st.thickness);
|
||||
p.setPen(pen);
|
||||
if (_flags & PollData::Flag::MultiChoice) {
|
||||
p.drawRoundedRect(rect, st::buttonRadius, st::buttonRadius);
|
||||
} else {
|
||||
p.drawEllipse(rect);
|
||||
}
|
||||
}
|
||||
if (checkmark > 0.) {
|
||||
const auto removeFull = (st.diameter / 2 - st.thickness);
|
||||
const auto removeNow = removeFull * (1. - checkmark);
|
||||
|
|
@ -1178,7 +1182,13 @@ void Poll::paintRadio(
|
|||
pen.setWidth(st.thickness);
|
||||
p.setPen(pen);
|
||||
p.setBrush(color);
|
||||
if (_flags & PollData::Flag::MultiChoice) {
|
||||
p.drawRoundedRect(
|
||||
rect.marginsRemoved({ removeNow, removeNow, removeNow, removeNow }),
|
||||
st::buttonRadius, st::buttonRadius);
|
||||
} else {
|
||||
p.drawEllipse(rect.marginsRemoved({ removeNow, removeNow, removeNow, removeNow }));
|
||||
}
|
||||
const auto &icon = outbg ? (selected ? st::historyPollOutChosenSelected : st::historyPollOutChosen) : (selected ? st::historyPollInChosenSelected : st::historyPollInChosen);
|
||||
icon.paint(p, left + (st.diameter - icon.width()) / 2, top + (st.diameter - icon.height()) / 2, width());
|
||||
}
|
||||
|
|
@ -1251,7 +1261,13 @@ void Poll::paintFilling(
|
|||
: st::historyPollChoiceRight;
|
||||
const auto cleft = aleft - st::historyPollPercentSkip - icon.width();
|
||||
const auto ctop = ftop - (icon.height() - thickness) / 2;
|
||||
if (_flags & PollData::Flag::MultiChoice) {
|
||||
p.drawRoundedRect(
|
||||
QRect{ cleft, ctop, icon.width(), icon.height() },
|
||||
st::buttonRadius, st::buttonRadius);
|
||||
} else {
|
||||
p.drawEllipse(cleft, ctop, icon.width(), icon.height());
|
||||
}
|
||||
icon.paint(p, cleft, ctop, width);
|
||||
//barleft += icon.width() - radius;
|
||||
//barwidth -= icon.width() - radius;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue