keep the position bounded to what setColorAt wants

svn path=/trunk/KDE/kdelibs/; revision=1084461
This commit is contained in:
Aaron J. Seigo 2010-02-03 08:41:25 +00:00
parent 8fc5c0d2b0
commit 9e1aa5472f

View File

@ -304,11 +304,11 @@ void NativeTabBar::paintEvent(QPaintEvent *event)
if (textRect.left() < contentsRect().left()) {
gradient.setColorAt(0, Qt::transparent);
gradient.setColorAt((-(qreal)textRect.left())/(qreal)textRect.width(), Qt::transparent);
gradient.setColorAt(qBound(qreal(0), (-(qreal)textRect.left())/(qreal)textRect.width(), qreal(1)), Qt::transparent);
gradient.setColorAt(1, Qt::black);
} else {
gradient.setColorAt(0, Qt::black);
gradient.setColorAt(1 - (qreal)(textRect.right() - endTabSpace)/(qreal)textRect.width(), Qt::transparent);
gradient.setColorAt(qBound(qreal(0), 1 - (qreal)(textRect.right() - endTabSpace)/(qreal)textRect.width(), qreal(1)), Qt::transparent);
gradient.setColorAt(1, Qt::transparent);
}