kcontrol: take margins into account when drawing in desktoptheme KCM

otherwise some look off

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-21 01:12:06 +03:00
parent a62e897f42
commit 513f747ff9

View file

@ -181,8 +181,13 @@ void ThemeDelegate::paint(QPainter *painter,
// draw image // draw image
Plasma::FrameSvg *svg = static_cast<Plasma::FrameSvg *>( Plasma::FrameSvg *svg = static_cast<Plasma::FrameSvg *>(
index.model()->data(index, ThemeModel::SvgRole).value<void *>()); index.model()->data(index, ThemeModel::SvgRole).value<void *>());
svg->resizeFrame(QSize(option.rect.width() - (2 * MARGIN), 100 - (2 * MARGIN))); qreal left = 0.0;
svg->paintFrame(painter, QPoint(option.rect.left() + MARGIN, option.rect.top() + MARGIN)); qreal top = 0.0;
qreal right = 0.0;
qreal bottom = 0.0;
svg->getMargins(left, top, right, bottom);
svg->resizeFrame(QSize(option.rect.width() - (2 * MARGIN) + (2 * left), 100 - (2 * MARGIN) + (2 * top)));
svg->paintFrame(painter, QPoint(option.rect.left() - left + MARGIN, option.rect.top() - top + MARGIN));
// draw text // draw text
painter->save(); painter->save();