QFusionStyle: don't draw an invalid outline for up/down buttons
When they are disabled ('NoButtons'). Otherwise, we end up with a tiny dot (top left or right corner of a spinbox). Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-99486 Change-Id: Ic99f4bce2abd57c988254296a749b5d5b23cfb39 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
c0ca46de3e
commit
8c4dee6f97
@ -2027,22 +2027,24 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||||||
cachePainter.setPen(d->topShadow());
|
cachePainter.setPen(d->topShadow());
|
||||||
cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
|
cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
|
||||||
|
|
||||||
// Draw button gradient
|
if (!upRect.isNull()) {
|
||||||
QColor buttonColor = d->buttonColor(option->palette);
|
// Draw button gradient
|
||||||
QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2);
|
const QColor buttonColor = d->buttonColor(option->palette);
|
||||||
QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
|
const QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2);
|
||||||
|
const QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver )
|
||||||
|
? buttonColor : buttonColor.darker(104));
|
||||||
|
|
||||||
// Draw button gradient
|
cachePainter.setPen(Qt::NoPen);
|
||||||
cachePainter.setPen(Qt::NoPen);
|
cachePainter.setBrush(gradient);
|
||||||
cachePainter.setBrush(gradient);
|
|
||||||
|
|
||||||
cachePainter.save();
|
cachePainter.save();
|
||||||
cachePainter.setClipRect(updownRect);
|
cachePainter.setClipRect(updownRect);
|
||||||
cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
|
cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
|
||||||
cachePainter.setPen(QPen(d->innerContrastLine()));
|
cachePainter.setPen(QPen(d->innerContrastLine()));
|
||||||
cachePainter.setBrush(Qt::NoBrush);
|
cachePainter.setBrush(Qt::NoBrush);
|
||||||
cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2);
|
cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2);
|
||||||
cachePainter.restore();
|
cachePainter.restore();
|
||||||
|
}
|
||||||
|
|
||||||
if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
|
if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
|
||||||
if (sunken)
|
if (sunken)
|
||||||
@ -2070,12 +2072,14 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||||||
cachePainter.restore();
|
cachePainter.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
// outline the up/down buttons
|
if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
|
||||||
cachePainter.setPen(outline);
|
// buttonSymbols == NoButtons results in 'null' rects
|
||||||
if (spinBox->direction == Qt::RightToLeft) {
|
// and a tiny rect painted in the corner.
|
||||||
cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1);
|
cachePainter.setPen(outline);
|
||||||
} else {
|
if (spinBox->direction == Qt::RightToLeft)
|
||||||
cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1);
|
cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1);
|
||||||
|
else
|
||||||
|
cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upIsActive && sunken) {
|
if (upIsActive && sunken) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user