GameList: Clip flag and compatibility pixmaps to the available space

This commit is contained in:
chaoticgd authored and lightningterror committed 2025-05-31 02:35:34 +02:00
1 parent 26a4f71385
commit cd0c1607ef
1 file changed
+7
+7
View File
@@ -128,6 +128,10 @@ namespace
const int pix_width = static_cast<int>(pix.width() / pix.devicePixelRatio());
const int pix_height = static_cast<int>(pix.height() / pix.devicePixelRatio());
// Clip the pixmaps so they don't extend outside the column
painter->save();
painter->setClipRect(option.rect);
// Draw the icon, using code derived from QItemDelegate::drawDecoration()
const bool enabled = option.state & QStyle::State_Enabled;
const QPoint p = QPoint((r.width() - pix_width) / 2, (r.height() - pix_height) / 2);
@@ -159,6 +163,9 @@ namespace
{
painter->drawPixmap(r.topLeft() + p, pix);
}
// Restore the old clip path.
painter->restore();
}
};
} // namespace