From 127e1244609b2eea6af1bc47ab02abf125a9454f Mon Sep 17 00:00:00 2001 From: Jan Blackquill Date: Sat, 28 Aug 2021 19:43:59 -0400 Subject: [PATCH] kstyle: fix misalignment of spinbox item sizes --- kstyle/breezestyle.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 380bc2d0..04d87b4e 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -2368,6 +2368,11 @@ namespace Breeze // copy rect auto rect( option->rect ); + if (subControl == SC_SpinBoxUp || subControl == SC_SpinBoxDown) { + // compensate for 1px margin + 1px border + rect.adjust( 2, 2, -2, -2 ); + } + switch( subControl ) { case SC_SpinBoxFrame: return flat ? QRect():rect; @@ -2375,14 +2380,16 @@ namespace Breeze case SC_SpinBoxUp: { auto r = rect; - r.setLeft(r.width()-buttonSize); + r.setWidth(buttonSize); + r.moveRight(rect.right()); return r; } case SC_SpinBoxDown: { auto r = rect; - r.setRight(buttonSize); + r.setWidth(buttonSize); + r.moveLeft(rect.left()); return r; } @@ -6884,9 +6891,9 @@ namespace Breeze painter->setPen( _helper->separatorColor( palette )); if (subControl == SC_SpinBoxUp) { - painter->drawLine(QLine(arrowRect.topLeft()+QPoint(1, 4), arrowRect.bottomLeft()-QPoint(-1, 4))); + painter->drawLine(QLine(arrowRect.topLeft()+QPoint(0, 2), arrowRect.bottomLeft()-QPoint(0, 2))); } else { - painter->drawLine(QLine(arrowRect.topRight()+QPoint(0, 4), arrowRect.bottomRight()-QPoint(0, 4))); + painter->drawLine(QLine(arrowRect.topRight()+QPoint(0, 2), arrowRect.bottomRight()-QPoint(0, 2))); } }