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

View file

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