Nominate our 2022 Qt Champions!

[Solved]Flickable - Help

  • Can anyone show me what the right syntax for flickable(vertically)? I'm trying to make my background move when you drag the screen because it usually fits the image into the screen.

    import Qt 4.7

    Rectangle {
    id: mainwindow

    height: 402
    width: 452
    Flickable {
        id: flick
        function addItem(bg){
            var component = Qt.createComponent(bg)
        boundsBehavior: Flickable.StopAtBounds
        Rectangle {
            id: scrollbar
            anchors.right: flickable.right
            y: flickable.visibleArea.yPosition * flickable.height
            width: 10
            height: flickable.visibleArea.heightRatio * flickable.height
            color: "black"
        Image {
            id: bg
            source: "image.jpg"


    Thank you! :D

  • If I understand your question correctly, you need to set

    width, height, contentHeight,ContextWidgth properties of your flick element.

    see "Flickable documentation": for more details.

  • This is a Example of Usage :

    @ import QtQuick 1.0

    Flickable {
    width: 200; height: 200
    contentWidth: image.width; contentHeight: image.height

     Image { id: image; source: "bigImage.png" }


  • facepalm I failed miserably at that part. I got it now thanks! :)

Log in to reply