Skip to content

Commit e363635

Browse files
committed
Fix spinbox size and frame
1 parent bb5e197 commit e363635

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

styles/qthaikustyle/haiku/qhaikustyle.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ void QHaikuStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
19371937

19381938
QRect rect = option->rect.adjusted(0, 0, 0, 0);
19391939
BRect bRect(0.0f, 0.0f, rect.width() - 1, rect.height() - 1);
1940-
QRect editRect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
1940+
QRect editRect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget).adjusted(-2,-2,2,2);
19411941
QRect upRect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
19421942
QRect downRect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
19431943
BRect bEditRect(editRect.left(), editRect.top(), editRect.right(), editRect.bottom());
@@ -1954,7 +1954,6 @@ void QHaikuStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
19541954
flags |= BControlLook::B_FOCUSED;
19551955

19561956
TemporarySurface surface(bRect);
1957-
bEditRect.InsetBy(-2, -2);
19581957
surface.view()->SetViewColor(bgColor);
19591958
surface.view()->SetLowColor(bgColor);
19601959
surface.view()->SetHighColor(bgColor);
@@ -2609,7 +2608,7 @@ int QHaikuStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, con
26092608
ret = 5;
26102609
break;
26112610
case PM_SpinBoxFrameWidth:
2612-
ret = 6;
2611+
ret = 2;
26132612
break;
26142613
case PM_MenuBarItemSpacing:
26152614
ret = 0;
@@ -2731,6 +2730,7 @@ QSize QHaikuStyle::sizeFromContents(ContentsType type, const QStyleOption *optio
27312730
}
27322731
break;
27332732
case CT_SpinBox:
2733+
newSize += QSize(0, 3);
27342734
break;
27352735
case CT_ComboBox:
27362736
newSize = sizeFromContents(CT_PushButton, option, size, widget);
@@ -3103,25 +3103,25 @@ QRect QHaikuStyle::subControlRect(ComplexControl control, const QStyleOptionComp
31033103
if(option->rect.height()-(frameWidth*2) < 16)
31043104
frameWidth = -(16 - option->rect.height()) / 2;
31053105
int space = 3;
3106-
QRect frame = spinbox->rect.adjusted(1, frameWidth, -1, -frameWidth);
3106+
QRect frame = spinbox->rect.adjusted(0, frameWidth, 0, -frameWidth);
31073107
QSize buttonSize = QSize(frame.height() * 0.7, frame.height() + 4);
31083108

31093109
switch (subControl) {
31103110
case SC_SpinBoxUp:
31113111
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
31123112
return QRect();
3113-
rect = QRect(spinbox->rect.right() - buttonSize.width(), frame.top() - 2, buttonSize.width(), buttonSize.height());
3113+
rect = QRect(spinbox->rect.right() - buttonSize.width(), frame.top() - 3, buttonSize.width() + 2, buttonSize.height() + 2);
31143114
break;
31153115
case SC_SpinBoxDown:
31163116
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
31173117
return QRect();
3118-
rect = QRect(spinbox->rect.right() - buttonSize.width() * 2, frame.top() - 2, buttonSize.width(), buttonSize.height());
3118+
rect = QRect((spinbox->rect.right() - buttonSize.width() * 2) - 1, frame.top() - 3, buttonSize.width() + 1, buttonSize.height() + 2);
31193119
break;
31203120
case SC_SpinBoxEditField:
31213121
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
3122-
rect = frame;
3122+
rect = frame.adjusted(1,1,-1,-1);
31233123
} else {
3124-
rect = QRect(frame.left(), frame.top(), spinbox->rect.width() - buttonSize.width() * 2 - space, frame.height());
3124+
rect = QRect(frame.left()+1, frame.top()-1, (spinbox->rect.width() - buttonSize.width() * 2 - space) - 1, frame.bottom() + 1);
31253125
}
31263126
break;
31273127
case SC_SpinBoxFrame:

0 commit comments

Comments
 (0)