December 22, 2011

ephe ephe
Lab Rat
106 posts

Adjust PathView transition time of decrementCurrentIndex, incrementCurrentIndex

 

Is it possible to change the transition time of

  1. Keys.onRightPressed: incrementCurrentIndex()
  2. Keys.onLeftPressed: decrementCurrentIndex()
?

I’ve got the following PathView:

  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4.  
  5.     id: pageControl
  6.  
  7.     width: 360
  8.     height: 360
  9.  
  10.     ListModel {
  11.         id: appModel
  12.         ListElement { pageColor: "blue" }
  13.         ListElement { pageColor: "green" }
  14.         ListElement { pageColor: "red" }
  15.         ListElement { pageColor: "gray" }
  16.         ListElement { pageColor: "black" }
  17.         ListElement { pageColor: "purple" }
  18.     }
  19.  
  20.     listModel: appModel
  21.  
  22.     property ListModel listModel
  23.  
  24.     Component {
  25.         id: appDelegate
  26.  
  27.         Rectangle {
  28.             smooth: true
  29.             width: pageControl.width
  30.             height: pageControl.height
  31.             color: pageColor
  32.  
  33.         }
  34.     }
  35.  
  36.     PathView {
  37.         id: myPathView
  38.  
  39.         width: parent.width
  40.         anchors.top: parent.top
  41.  
  42.         Keys.onRightPressed: incrementCurrentIndex()
  43.         Keys.onLeftPressed: decrementCurrentIndex()
  44.  
  45.         focus: true
  46.         interactive: true
  47.         model: listModel
  48.         delegate: appDelegate
  49.         path: Path {
  50.             startX: - pageControl.width * listModel.count / 2 + pageControl.width / 2
  51.             startY: pageControl.height / 2
  52.             PathLine {
  53.                 x: pageControl.width * listModel.count / 2 + pageControl.width / 2
  54.                 y: pageControl.height / 2
  55.             }
  56.         }
  57.     }
  58.  
  59. }
(it’s a short version of this [developer.nokia.com] example)
In the wiki example, the flicking is quite slow and it can also be adjusted, but the key events are always quite fast. Is it possible to adjust them?

Thank you!

0 replies

 
  ‹‹ Problem : Show page from other Qml file      [SOLVED]Image and relative pathes to the image ››

You must log in to post a reply. Not a member yet? Register here!