Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved]Flickable - Help

[Solved]Flickable - Help

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FlyingFish
    wrote on last edited by
    #1

    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)
            component.createObject(flick.contentItem);
    
        }
    
        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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thisisbhaskar
      wrote on last edited by
      #2

      If I understand your question correctly, you need to set

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

      see "Flickable documentation":http://doc.qt.nokia.com/4.7-snapshot/qml-flickable.html for more details.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saidiahd
        wrote on last edited by
        #3

        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" }
        

        }@

        "Learn from yesterday, live for today, hope for tomorrow." - Albert Einstein -

        1 Reply Last reply
        0
        • F Offline
          F Offline
          FlyingFish
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved