correct the margins
react to scrollbars being visible or invisible correct margins of the borders
This commit is contained in:
parent
78848d5d50
commit
2cda92af4c
@ -73,8 +73,7 @@ Item {
|
|||||||
property Item verticalScrollBar
|
property Item verticalScrollBar
|
||||||
property Item horizontalScrollBar
|
property Item horizontalScrollBar
|
||||||
|
|
||||||
function checkVerticalScrollBar()
|
function checkVerticalScrollBar() {
|
||||||
{
|
|
||||||
if (!flickableItem) {
|
if (!flickableItem) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -94,10 +93,13 @@ Item {
|
|||||||
verticalScrollBar = sectionScrollerComponent.createObject(root)
|
verticalScrollBar = sectionScrollerComponent.createObject(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
checkVerticalScrollBarMargins()
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkVerticalScrollBarMargins() {
|
||||||
//undefined in case of SectionScroller
|
//undefined in case of SectionScroller
|
||||||
if ((flickableItem.contentHeight > flickableItem.height) &&
|
if ((flickableItem.contentHeight > flickableItem.height) &&
|
||||||
(verticalScrollBar.interactive || (verticalScrollBar.orientation === undefined &&
|
((verticalScrollBar.interactive && verticalScrollBar.visible) || (verticalScrollBar.orientation === undefined &&
|
||||||
//FIXME: heuristic on width to distinguish the touch sectionscroller
|
//FIXME: heuristic on width to distinguish the touch sectionscroller
|
||||||
verticalScrollBar.width < 30))) {
|
verticalScrollBar.width < 30))) {
|
||||||
flickableItem.anchors.rightMargin = verticalScrollBar.width
|
flickableItem.anchors.rightMargin = verticalScrollBar.width
|
||||||
@ -106,8 +108,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkHorizontalScrollBar()
|
function checkHorizontalScrollBar() {
|
||||||
{
|
|
||||||
if (!flickableItem || horizontalScrollBar) {
|
if (!flickableItem || horizontalScrollBar) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -117,9 +118,12 @@ Item {
|
|||||||
horizontalScrollBar = horizontalScrollBarComponent.createObject(root)
|
horizontalScrollBar = horizontalScrollBarComponent.createObject(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
checkHorizontalScrollBarMargins()
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkHorizontalScrollBarMargins() {
|
||||||
if ((flickableItem.contentWidth > flickableItem.width) &&
|
if ((flickableItem.contentWidth > flickableItem.width) &&
|
||||||
horizontalScrollBar.interactive) {
|
horizontalScrollBar.interactive && horizontalScrollBar.visible) {
|
||||||
flickableItem.anchors.bottomMargin = horizontalScrollBar.height
|
flickableItem.anchors.bottomMargin = horizontalScrollBar.height
|
||||||
} else {
|
} else {
|
||||||
flickableItem.anchors.bottomMargin = 0
|
flickableItem.anchors.bottomMargin = 0
|
||||||
@ -140,6 +144,7 @@ Item {
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
bottomMargin: parent.height - root.flickableItem.height
|
bottomMargin: parent.height - root.flickableItem.height
|
||||||
}
|
}
|
||||||
|
onVisibleChanged: internal.checkVerticalScrollBarMargins()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
@ -155,6 +160,7 @@ Item {
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
rightMargin: parent.width - root.flickableItem.width
|
rightMargin: parent.width - root.flickableItem.width
|
||||||
}
|
}
|
||||||
|
onVisibleChanged: internal.checkHorizontalScrollBarMargins()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
@ -170,6 +176,7 @@ Item {
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
bottomMargin: parent.height - root.flickableItem.height
|
bottomMargin: parent.height - root.flickableItem.height
|
||||||
}
|
}
|
||||||
|
onVisibleChanged: internal.checkVerticalScrollBarMargins()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FIXME: create all this stuff only on demand, like scrollbars?
|
//FIXME: create all this stuff only on demand, like scrollbars?
|
||||||
@ -194,6 +201,7 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
topMargin: flickableItem.anchors.topMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.SvgItem {
|
PlasmaCore.SvgItem {
|
||||||
@ -213,6 +221,7 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
bottomMargin: flickableItem.anchors.bottomMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.SvgItem {
|
PlasmaCore.SvgItem {
|
||||||
@ -231,6 +240,7 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
|
leftMargin: flickableItem.anchors.leftMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.SvgItem {
|
PlasmaCore.SvgItem {
|
||||||
@ -249,6 +259,7 @@ Item {
|
|||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
rightMargin: flickableItem.anchors.rightMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user