diff --git a/src/declarativeimports/plasmacomponents/qml/TabBar.qml b/src/declarativeimports/plasmacomponents/qml/TabBar.qml --- a/src/declarativeimports/plasmacomponents/qml/TabBar.qml +++ b/src/declarativeimports/plasmacomponents/qml/TabBar.qml @@ -171,7 +171,11 @@ } } - onCurrentTabChanged: { + onCurrentTabChanged: updateTabPosition() + onWidthChanged: updateTabPosition() + onHeightChanged: updateTabPosition() + + function updateTabPosition() { if (!currentTab) { return; } @@ -182,16 +186,6 @@ } } - onWidthChanged: { - if (currentTab) { - if (layout.isHorizontal) { - tabBarLayout.x = Math.max(Math.min(0, -(currentTab.x + currentTab.width/2) + tabbarScroller.width/2), -tabBarLayout.width + tabbarScroller.width); - } else { - tabBarLayout.y = Math.max(Math.min(0, -(currentTab.y + currentTab.height/2) + tabbarScroller.height/2), -tabBarLayout.height + tabbarScroller.height); - } - } - } - Item { id: tabbarScroller clip: true