summaryrefslogtreecommitdiff
path: root/navit/gui/qml/skins/navit/ListSelector.qml
blob: 09c927cf1abea83c3be534c11d96d0b368a9cc98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import Qt 4.7

Rectangle {
    id: listselector
    width: parent.width; height: parent.height
    color: "Black"


    property string text: "ListSelector"
    property string value: ""
    property int itemId: 0
    property bool showScroller: false
    signal changed

    function startup() {
        if (listselector.showScroller == true) {
		listScroller.opacity=0.5;
	}
    }
    
    Component.onCompleted: startup();    

    Text {
	id: labelTxt; text: listselector.text; color: "White"; font.pointSize: 22;
	anchors.horizontalCenter: list.horizontalCenter
	anchors.verticalCenter: listselector.top
    }

	ListView {
	     id: list;
             width: listselector.width*0.8; height: listselector.height
	     anchors.top: labelTxt.bottom;
	     anchors.left: listselector.left
             model: listModel
             delegate: listDelegate
             highlight: listHighlight
	     clip: true
	     highlightFollowsCurrentItem: true
	     keyNavigationWraps: true
	     
	     Component.onCompleted: { list.currentIndex=listselector.itemId; }
         }
	 Rectangle {
       		 id: listScroller
		opacity: 0; anchors.left: list.right; anchors.leftMargin: 4; width: 6
		y: (list.visibleArea.yPosition * list.height)+(list.visibleArea.heightRatio * list.height/4)
		height: list.visibleArea.heightRatio * list.height
	}
}