Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1041326
  • 博文数量: 264
  • 博客积分: 6005
  • 博客等级: 大校
  • 技术积分: 2798
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 20:15
文章分类

全部博文(264)

文章存档

2011年(42)

2010年(213)

2009年(4)

2008年(2)

2007年(3)

分类:

2010-10-14 21:47:37

import Qt 4.7
Rectangle {
    width: 800; height: 480
    color: "black"
    Component.onCompleted: animation.start()
    Flow {
        id: flow
        property real originalWidth: 790
        x: 5; y: 5
        width: originalWidth
        spacing: 10
        Repeater {
            id: repeater
            model: 104
            Rectangle {
                width: 20; height: 20
                color: { var c = index / repeater.count; return Qt.rgba(1-c, c, c, 1) }
            }
        }
    }
    SequentialAnimation {
        id: animation
        loops: Animation.Infinite
        PropertyAnimation { target: flow; property: "width"; to: 200; duration: 1000 }
        PropertyAnimation { target: flow; property: "width"; to: flow.originalWidth; duration: 1000 }
    }
}

阅读(2078) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

charles_gz2014-10-11 18:02:38

大牛,通过你的代码知道怎么利用Flow动态添加item了。感谢