Commit 7752d95d authored by Samikshan Bairagya's avatar Samikshan Bairagya

Added scrollbar for sky-object listview in QML interface.

parent 0abd6fe7
#install_files
install( FILES wiview.qml
install( FILES wiview.qml ScrollBar.qml
leftArrow.png
settingsIcon.png
next.png
......
import QtQuick 1.0
Rectangle {
// The flickable to which the scrollbar is attached to, must be set
property variant flickable
// True for vertical ScrollBar, false for horizontal
property bool vertical: true
// If set to false, scrollbar is visible even when not scrolling
property bool hideScrollBarsWhenStopped: true
// Thickness of the scrollbar, in pixels
property int scrollbarWidth: 10
color: "gray"
radius: vertical ? width/2 : height/2
function sbOpacity()
{
if (!hideScrollBarsWhenStopped) {
return 0.5;
}
return (flickable.flicking || flickable.moving) ? (vertical ? (height >= parent.height ? 0 : 0.5) : (width >= parent.width ? 0 : 0.5)) : 0;
}
// Scrollbar appears automatically when content is bigger than the Flickable
opacity: sbOpacity()
// Calculate width/height and position based on the content size and position of
// the Flickable
width: vertical ? scrollbarWidth : flickable.visibleArea.widthRatio * parent.width
height: vertical ? flickable.visibleArea.heightRatio * parent.height : scrollbarWidth
x: vertical ? parent.width - width : flickable.visibleArea.xPosition * parent.width
y: vertical ? flickable.visibleArea.yPosition * parent.height : parent.height - height
// Animate scrollbar appearing/disappearing
Behavior on opacity { NumberAnimation { duration: 200 }}
}
......@@ -368,6 +368,11 @@ Rectangle {
signal soListItemClicked( int type, string typeName, int curIndex )
clip: true
ScrollBar {
flickable: soListView
vertical: true
}
delegate: Item {
id: soListItem
x: 5
......
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