Fixed paint of mini icon in dialogs list even there is no space for it.

This commit is contained in:
23rd 2023-09-03 17:47:36 +03:00 committed by John Preston
parent 7740780eeb
commit 738aff9c4f
1 changed files with 15 additions and 9 deletions

View File

@ -328,15 +328,23 @@ void MessageView::paint(
*_leftIcon,
context.active,
context.selected);
if (_hasPlainLinkAtBegin && !context.active) {
icon.paint(p, rect.topLeft(), rect.width(), palette->linkFg->c);
} else {
icon.paint(p, rect.topLeft(), rect.width());
const auto w = (icon.width());
if (rect.width() > w) {
if (_hasPlainLinkAtBegin && !context.active) {
icon.paint(
p,
rect.topLeft(),
rect.width(),
palette->linkFg->c);
} else {
icon.paint(p, rect.topLeft(), rect.width());
}
rect.setLeft(rect.x() + w + st::dialogsMiniIconSkip);
}
rect.setLeft(rect.x() + icon.width() + st::dialogsMiniIconSkip);
}
for (const auto &image : _imagesCache) {
if (rect.width() < st::dialogsMiniPreview) {
const auto w = st::dialogsMiniPreview + st::dialogsMiniPreviewSkip;
if (rect.width() < w) {
break;
}
const auto mini = QRect(
@ -352,9 +360,7 @@ void MessageView::paint(
FillSpoilerRect(p, mini, frame);
}
}
rect.setLeft(rect.x()
+ st::dialogsMiniPreview
+ st::dialogsMiniPreviewSkip);
rect.setLeft(rect.x() + w);
}
if (!_imagesCache.empty()) {
rect.setLeft(rect.x() + st::dialogsMiniPreviewRight);