Commit b64d103b authored by Thomas Hartmann's avatar Thomas Hartmann Committed by hjk
Browse files

WelcomePage: adjust scrolling in recent sessions



The avoid cutting of half an item vertically we snap
instead to full items.

Change-Id: Iaeda1e6ef010804a0f1df4b94057eefea4d75830
Reviewed-by: default avatarVirva Auvinen <virva.auvinen@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent d74d0325
......@@ -33,39 +33,58 @@
import QtQuick 1.0
import qtcomponents 1.0
ScrollArea {
ListView {
id: root
property alias model: repeater.model
height: Math.min(count * delegateHeight, 276)
snapMode: ListView.SnapToItem
property int delegateHeight: currentItem.height + spacing
property alias listHeight: column.height
height: Math.min(listHeight, 276)
frame: false
horizontalScrollBar.visible: false
clip: true
interactive: false
Column {
id: column
spacing: 4
spacing: 8
delegate: SessionItem {
id: item
Repeater {
id: repeater
SessionItem {
function fullSessionName()
{
var newSessionName = sessionName
if (model.lastSession && sessionList.isDefaultVirgin())
newSessionName = qsTr("%1 (last session)").arg(sessionName);
else if (model.activeSession && !sessionList.isDefaultVirgin())
newSessionName = qsTr("%1 (current session)").arg(sessionName);
return newSessionName;
}
function fullSessionName()
{
var newSessionName = sessionName
if (model.lastSession && sessionList.isDefaultVirgin())
newSessionName = qsTr("%1 (last session)").arg(sessionName);
else if (model.activeSession && !sessionList.isDefaultVirgin())
newSessionName = qsTr("%1 (current session)").arg(sessionName);
return newSessionName;
}
name: fullSessionName()
}
name: fullSessionName()
}
}
WheelArea {
id: wheelarea
anchors.fill: parent
verticalMinimumValue: vscrollbar.minimumValue
verticalMaximumValue: vscrollbar.maximumValue
onVerticalValueChanged: root.contentY = Math.round(verticalValue / delegateHeight) * delegateHeight
}
ScrollBar {
id: vscrollbar
orientation: Qt.Vertical
property int availableHeight : root.height
visible: contentHeight > availableHeight
maximumValue: contentHeight > availableHeight ? root.contentHeight - availableHeight : 0
minimumValue: 0
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
singleStep: delegateHeight
anchors.topMargin: styleitem.style == "mac" ? 1 : 0
onValueChanged: root.contentY = Math.round(value / delegateHeight) * delegateHeight
anchors.rightMargin: styleitem.frameoffset
anchors.bottomMargin: styleitem.frameoffset
}
}
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