Show poll's multiple answer radios as checkboxes

This commit is contained in:
Eric Kotato 2020-07-22 17:20:32 +03:00
parent 6f5e0b051a
commit 9ee1e4347b

View file

@ -1168,7 +1168,11 @@ void Poll::paintRadio(
auto pen = regular->p;
pen.setWidth(st.thickness);
p.setPen(pen);
p.drawEllipse(rect);
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);
@ -1178,7 +1182,13 @@ void Poll::paintRadio(
pen.setWidth(st.thickness);
p.setPen(pen);
p.setBrush(color);
p.drawEllipse(rect.marginsRemoved({ removeNow, removeNow, removeNow, removeNow }));
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;
p.drawEllipse(cleft, ctop, icon.width(), icon.height());
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;