QTabBar: clamp maxScrollOffset before using it in qBound
QTabBar's test reveals that maxScrollOffset can be negative, so using it in a call like qBound(0, x, maxScrollOffset) is wrong. Clamp it to 0. Change-Id: Idd635343bf14c904dbcc4d141f10bd0161d2cfb4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
d281274c3f
commit
e977b55346
|
|
@ -2408,9 +2408,9 @@ void QTabBar::wheelEvent(QWheelEvent *event)
|
|||
if (!d->rightB->isVisible())
|
||||
scrollRectExtent += tabsVertical ? d->rightB->height() : d->rightB->width();
|
||||
|
||||
const int maxScrollOffset = (tabsVertical ? lastTabRect.bottom()
|
||||
: lastTabRect.right())
|
||||
- scrollRectExtent;
|
||||
const int maxScrollOffset = qMax((tabsVertical ?
|
||||
lastTabRect.bottom() :
|
||||
lastTabRect.right()) - scrollRectExtent, 0);
|
||||
d->scrollOffset = qBound(0, d->scrollOffset - delta, maxScrollOffset);
|
||||
d->leftB->setEnabled(d->scrollOffset > -scrollRect.left());
|
||||
d->rightB->setEnabled(maxScrollOffset > d->scrollOffset);
|
||||
|
|
|
|||
Loading…
Reference in New Issue