A bit of snap before scolling the layout

This commit is contained in:
Marco Martin 2012-10-11 11:09:07 +02:00
parent bc631e4467
commit 8d327acc6f
2 changed files with 7 additions and 1 deletions

View File

@ -108,6 +108,9 @@ FocusScope {
onCurrentTabChanged: tabBarLayout.x = Math.max(Math.min(0, -(currentTab.x + currentTab.width/2) + tabbarScroller.width/2), -tabBarLayout.width + tabbarScroller.width)
Text {
text: tabBarLayout.implicitWidth + " " + tabBarLayout.width + " " + tabbarScroller.width
}
onWidthChanged: tabBarLayout.x = Math.max(Math.min(0, -(currentTab.x + currentTab.width/2) + tabbarScroller.width/2), -tabBarLayout.width + tabbarScroller.width)
@ -124,7 +127,8 @@ FocusScope {
Private.TabBarLayout {
id: tabBarLayout
width: Math.max(parent.width, implicitWidth)
//A bit of snap before scolling the layout
width: (implicitWidth - parent.width < theme.defaultFont.mSize.width*4) ? parent.width : implicitWidth
anchors {
top: parent.top
bottom: parent.bottom

View File

@ -152,7 +152,9 @@ Item {
--visibleChildCount
}
}
var itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount
var itemIndex = mirrored ? childCount - 1 : 0
var increment = mirrored ? - 1 : 1
var visibleIndex = 0