summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2011-11-16 16:45:28 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-17 14:48:20 +0100
commit2a37fd0b8557c6b59f4638444efe90c292b27e18 (patch)
tree1972cd544d61e7d60981ad194f44c5eb24ba350c /src/widgets
parente70457fc4f60a17358e280f9b222f36bcd4f591f (diff)
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
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qmotifstyle.cpp10
-rw-r--r--src/widgets/styles/qplastiquestyle.cpp51
2 files changed, 33 insertions, 28 deletions
diff --git a/src/widgets/styles/qmotifstyle.cpp b/src/widgets/styles/qmotifstyle.cpp
index a18fc3ba97..46a64eb575 100644
--- a/src/widgets/styles/qmotifstyle.cpp
+++ b/src/widgets/styles/qmotifstyle.cpp
@@ -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;
diff --git a/src/widgets/styles/qplastiquestyle.cpp b/src/widgets/styles/qplastiquestyle.cpp
index 799bc95fdd..65e269f800 100644
--- a/src/widgets/styles/qplastiquestyle.cpp
+++ b/src/widgets/styles/qplastiquestyle.cpp
@@ -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