A bit of snap before scolling the layout
This commit is contained in:
parent
bc631e4467
commit
8d327acc6f
@ -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)
|
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)
|
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 {
|
Private.TabBarLayout {
|
||||||
id: 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 {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
|
@ -152,7 +152,9 @@ Item {
|
|||||||
--visibleChildCount
|
--visibleChildCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount
|
var itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount
|
||||||
|
|
||||||
var itemIndex = mirrored ? childCount - 1 : 0
|
var itemIndex = mirrored ? childCount - 1 : 0
|
||||||
var increment = mirrored ? - 1 : 1
|
var increment = mirrored ? - 1 : 1
|
||||||
var visibleIndex = 0
|
var visibleIndex = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user