From cf8a45fb08e29df1c50b865c45fcbc037b10a52e Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Sun, 4 May 2025 12:01:08 +0200 Subject: [PATCH] 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. --- src/controls/QskTabBar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls/QskTabBar.cpp b/src/controls/QskTabBar.cpp index eb0eaff8..83ed1c1c 100644 --- a/src/controls/QskTabBar.cpp +++ b/src/controls/QskTabBar.cpp @@ -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() ) ); } }