Fix sliders style issues.

Due to their widget heritage,some styles' logic for drawing sliders
incorrectly assumed a rect with a top left point at (0,0).

Change-Id: I02d9c32d925650ccb36e2b917dd890e5d2bbf925
Reviewed-by: Jens Bache-Wiig
bb10
Pierre Rossi 2011-11-16 16:45:28 +01:00 committed by Qt by Nokia
parent e70457fc4f
commit 2a37fd0b85
2 changed files with 33 additions and 28 deletions

View File

@ -1952,11 +1952,13 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
slider->upsideDown);
if (horizontal)
return visualRect(slider->direction, slider->rect,
QRect(sliderPos + motifBorder, tickOffset + motifBorder, len,
thickness - 2 * motifBorder));
QRect(sliderPos + motifBorder + slider->rect.left()
, tickOffset + motifBorder + slider->rect.top()
, len, thickness - 2 * motifBorder));
return visualRect(slider->direction, slider->rect,
QRect(tickOffset + motifBorder, sliderPos + motifBorder,
thickness - 2 * motifBorder, len));
QRect(tickOffset + motifBorder + slider->rect.left()
, sliderPos + motifBorder + slider->rect.top()
, thickness - 2 * motifBorder, len));
}
}
break;

View File

@ -3727,46 +3727,49 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("slider_groove-%0-%1").arg(ticksAbove).arg(ticksBelow))
p->fillRect(groove, option->palette.background());
rect = groove;
rect.moveTo(groove.left() - option->rect.left(), groove.top() - option->rect.top());
// draw groove
if (horizontal) {
p->setPen(borderColor);
const QLine lines[4] = {
QLine(groove.left() + 1, groove.top(),
groove.right() - 1, groove.top()),
QLine(groove.left() + 1, groove.bottom(),
groove.right() - 1, groove.bottom()),
QLine(groove.left(), groove.top() + 1,
groove.left(), groove.bottom() - 1),
QLine(groove.right(), groove.top() + 1,
groove.right(), groove.bottom() - 1) };
QLine(rect.left() + 1, rect.top(),
rect.right() - 1, rect.top()),
QLine(rect.left() + 1, rect.bottom(),
rect.right() - 1, rect.bottom()),
QLine(rect.left(), rect.top() + 1,
rect.left(), rect.bottom() - 1),
QLine(rect.right(), rect.top() + 1,
rect.right(), rect.bottom() - 1) };
p->drawLines(lines, 4);
p->setPen(alphaCornerColor);
const QPoint points[4] = {
QPoint(groove.left(), groove.top()),
QPoint(groove.left(), groove.bottom()),
QPoint(groove.right(), groove.top()),
QPoint(groove.right(), groove.bottom()) };
QPoint(rect.left(), rect.top()),
QPoint(rect.left(), rect.bottom()),
QPoint(rect.right(), rect.top()),
QPoint(rect.right(), rect.bottom()) };
p->drawPoints(points, 4);
} else {
p->setPen(borderColor);
const QLine lines[4] = {
QLine(groove.left() + 1, groove.top(),
groove.right() - 1, groove.top()),
QLine(groove.left() + 1, groove.bottom(),
groove.right() - 1, groove.bottom()),
QLine(groove.left(), groove.top() + 1,
groove.left(), groove.bottom() - 1),
QLine(groove.right(), groove.top() + 1,
groove.right(), groove.bottom() - 1) };
QLine(rect.left() + 1, rect.top(),
rect.right() - 1, rect.top()),
QLine(rect.left() + 1, rect.bottom(),
rect.right() - 1, rect.bottom()),
QLine(rect.left(), rect.top() + 1,
rect.left(), rect.bottom() - 1),
QLine(rect.right(), rect.top() + 1,
rect.right(), rect.bottom() - 1) };
p->drawLines(lines, 4);
p->setPen(alphaCornerColor);
const QPoint points[4] = {
QPoint(groove.left(), groove.top()),
QPoint(groove.right(), groove.top()),
QPoint(groove.left(), groove.bottom()),
QPoint(groove.right(), groove.bottom()) };
QPoint(rect.left(), rect.top()),
QPoint(rect.right(), rect.top()),
QPoint(rect.left(), rect.bottom()),
QPoint(rect.right(), rect.bottom()) };
p->drawPoints(points, 4);
}
END_STYLE_PIXMAPCACHE