Forums

OverviewV-Play 1 SupportFlickable › Reply To: Flickable

OverviewV-Play 1 SupportFlickable › Reply To: Flickable
#4221

Heini

Hi Chris,

i modify the contentY property manually to scroll to a certain position (what works on QML renderer).

 

Here is my code:

Scene {
  
  id: highscoreScene
  ....
  
  Component.onCompleted: {
    flickable.contentY = image.height * 10 //should bring  the 10th item to the top of the visible area
  }
  
  ListModel{
    id: listModel
    
    // there will be generated about 50 items  dynamically
  }
  
  Component {
    id: levelItemDelegate
    
    Image{
      id: image
      height: 40
      width: rect.width
      source: "image.png"
    }
  }
  
  Flickable {
    id: flickable
    anchors.centerIn: parent
    width: (parent.width<column.width) ? parent.width : column.width
    height: (parent.height<column.height) ? parent.height : column.height
    
    contentWidth: column.width
    contentHeight: column.height
    flickableDirection: Flickable.VerticalFlick
    
    Column {
      id: column
      anchors.centerIn: parent
      
      Repeater {
        id: repeater
        model: listModel
        delegate: levelItemDelegate
        
      }
    }
  }
}

;

Bye

Heini

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support