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:
Peter Hartmann 2025-05-04 12:01:08 +02:00 committed by GitHub
parent a10e4a244d
commit cf8a45fb08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ namespace
{
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() ) );
}
}