From 513f747ff9bb4a61b794f1373d53441b3583af9d Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 21 Apr 2024 01:12:06 +0300 Subject: [PATCH] kcontrol: take margins into account when drawing in desktoptheme KCM otherwise some look off Signed-off-by: Ivailo Monev --- kcontrol/desktoptheme/thememodel.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kcontrol/desktoptheme/thememodel.cpp b/kcontrol/desktoptheme/thememodel.cpp index e0d1917b..a060eb72 100644 --- a/kcontrol/desktoptheme/thememodel.cpp +++ b/kcontrol/desktoptheme/thememodel.cpp @@ -181,8 +181,13 @@ void ThemeDelegate::paint(QPainter *painter, // draw image Plasma::FrameSvg *svg = static_cast( index.model()->data(index, ThemeModel::SvgRole).value()); - svg->resizeFrame(QSize(option.rect.width() - (2 * MARGIN), 100 - (2 * MARGIN))); - svg->paintFrame(painter, QPoint(option.rect.left() + MARGIN, option.rect.top() + MARGIN)); + qreal left = 0.0; + 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 painter->save();