Fix incorrect initial tabs position for vertical tab bars

Summary:
This fixes the incorrect initial positioning of the tabs for vertical
tab bars that persisted until the user switched to another tab
manually.

BUG: 395390
FIXED-IN: 5.62

Reviewers: #plasma, ngraham, hein

Reviewed By: #plasma, ngraham, hein

Subscribers: kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T10047

Differential Revision: https://phabricator.kde.org/D23036
This commit is contained in:
Nate Graham 2019-08-08 20:03:43 -06:00
parent 4b427e4f03
commit e2cd97d822

View File

@ -171,7 +171,11 @@ FocusScope {
}
}
onCurrentTabChanged: {
onCurrentTabChanged: updateTabPosition()
onWidthChanged: updateTabPosition()
onHeightChanged: updateTabPosition()
function updateTabPosition() {
if (!currentTab) {
return;
}
@ -182,16 +186,6 @@ FocusScope {
}
}
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