examples/declarative/ui-components/spinner/content/Spinner.qml
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    43 Image {
    43 Image {
    44     property alias model: view.model
    44     property alias model: view.model
    45     property alias delegate: view.delegate
    45     property alias delegate: view.delegate
    46     property alias currentIndex: view.currentIndex
    46     property alias currentIndex: view.currentIndex
    47     property real itemHeight: 30
    47     property real itemHeight: 30
       
    48 
    48     source: "spinner-bg.png"
    49     source: "spinner-bg.png"
    49     clip: true
    50     clip: true
       
    51 
    50     PathView {
    52     PathView {
    51         id: view
    53         id: view
    52         anchors.fill: parent
    54         anchors.fill: parent
       
    55 
    53         pathItemCount: height/itemHeight
    56         pathItemCount: height/itemHeight
    54         preferredHighlightBegin: 0.5
    57         preferredHighlightBegin: 0.5
    55         preferredHighlightEnd: 0.5
    58         preferredHighlightEnd: 0.5
    56         highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
    59         highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
    57         dragMargin: view.width/2
    60         dragMargin: view.width/2
       
    61 
    58         path: Path {
    62         path: Path {
    59             startX: view.width/2; startY: -itemHeight/2
    63             startX: view.width/2; startY: -itemHeight/2
    60             PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
    64             PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
    61         }
    65         }
    62     }
    66     }
       
    67 
    63     Keys.onDownPressed: view.incrementCurrentIndex()
    68     Keys.onDownPressed: view.incrementCurrentIndex()
    64     Keys.onUpPressed: view.decrementCurrentIndex()
    69     Keys.onUpPressed: view.decrementCurrentIndex()
    65 }
    70 }