tab bar: Take scroll position into account when making item visible (#513)
If the tab bar is scrolled, the position we get from calling mapFromItem() is less than the real position with a scrolling of 0, because mapFromItem() does not know about our scroll position. This is usually not noticed when creating a tab bar, because the scroll position is (0,0). When calling this method on a scrolled tab bar, the problem becomes visible.
This commit is contained in:
parent
a10e4a244d
commit
cf8a45fb08
|
@ -129,7 +129,7 @@ namespace
|
||||||
{
|
{
|
||||||
if ( qskIsAncestorOf( this, item ) )
|
if ( qskIsAncestorOf( this, item ) )
|
||||||
{
|
{
|
||||||
const auto pos = mapFromItem( item, QPointF() );
|
const auto pos = mapFromItem( item, QPointF() ) + scrollPos();
|
||||||
ensureVisible( QRectF( pos.x(), pos.y(), item->width(), item->height() ) );
|
ensureVisible( QRectF( pos.x(), pos.y(), item->width(), item->height() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue