Fix QCommonStyle::drawControl(CE_ShapedFrame) for QFrame::H/VLine

Respect QStyleOption::rect, do not expect Y to be 0.

Task-number: QTBUG-29926
Change-Id: I6304d20f629f89774c897d2c81c2c7816dff4718
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
J-P Nurmi 2013-02-27 17:21:11 +01:00 committed by The Qt Project
parent 42507173bd
commit 55cf7c577d

View File

@ -2265,11 +2265,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case QFrame::VLine: { case QFrame::VLine: {
QPoint p1, p2; QPoint p1, p2;
if (frameShape == QFrame::HLine) { if (frameShape == QFrame::HLine) {
p1 = QPoint(opt->rect.x(), opt->rect.height() / 2); p1 = QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height() / 2);
p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y()); p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y());
} else { } else {
p1 = QPoint(opt->rect.x()+opt->rect.width() / 2, 0); p1 = QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y());
p2 = QPoint(p1.x(), opt->rect.height()); p2 = QPoint(p1.x(), p1.y() + opt->rect.height());
} }
if (frameShadow == QFrame::Plain) { if (frameShadow == QFrame::Plain) {
QPen oldPen = p->pen(); QPen oldPen = p->pen();