Commit d3c2e65f authored by Karel Slaný's avatar Karel Slaný
Browse files

Made menu lists scrollable via accessibility.

parent 43a855cb
......@@ -160,6 +160,12 @@ ListView {
Accessible.role: Accessible.Button
Accessible.name: name
Accessible.onScrollDownAction: {
root.scrollDown()
}
Accessible.onScrollUpAction: {
root.scrollUp()
}
Accessible.onPressAction: {
handleClick()
}
......@@ -170,5 +176,33 @@ ListView {
}
}
/*
* Scroll list down.
*/
function scrollDown() {
var numViewed = Math.ceil(root.height / (2 * headerHeight))
if (numViewed < 1) {
numViewed = 1
}
var indexAtTop = root.indexAt(1, 1 + root.contentY)
indexAtTop = (indexAtTop >= 0) ? (indexAtTop + numViewed) : 0
root.positionViewAtIndex(indexAtTop, ListView.Beginning)
root.returnToBounds()
}
/*
* Scroll list up.
*/
function scrollUp() {
var numViewed = Math.ceil(root.height / (2 * headerHeight))
if (numViewed < 1) {
numViewed = 1
}
var indexAtBottom = root.indexAt(1, root.height - 2 + root.contentY)
indexAtBottom = (indexAtBottom >= 0) ? (indexAtBottom - numViewed) : 0
root.positionViewAtIndex(indexAtBottom, ListView.End)
root.returnToBounds()
}
delegate: menuDelegate
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment