Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
import QtQuick 2.0
import QtQuick.Controls 
1.3  
import QtQuick.Window 
2.2  

ApplicationWindow 
{
    id: window 
    visible: 
true   
    title: qsTr(
"Hello World")  
    width: 
480  
    height: 
480  
    color: 
"#339546"
    property variant colorArray: [
"#00bde3","#67c111","#ea7025","#ef0748","#1894af"

    Column
    {
        id: flow
        spacing: 
2
        anchors.fill: parent

        Grid
        {
            anchors.margins: 
8
            spacing:
2
            Repeater
            {
                model: 
12
                Rectangle
                {
                    id: flag
                    width: 
120
                    height: 
0
                    property 
int colorIndex: Math.floor(Math.random()*5)
                    color: window.colorArray[colorIndex]
                    border.color: Qt.lighter(color)
                    Text
                    {
                        anchors.centerIn: parent
                        color: 
"#f0f0f0"
                        font.pixelSize: 
18
                        text: qsTr(
"WPS表单")
                    }

                    MouseArea 
                    {
                         anchors.fill: parent
                         onClicked: 
                         {
                             animateColor.start()
                             animateOpacity.start()
                         }
                    }

                    PropertyAnimation 
                    {
                         id: animateColor; 
                         target: flag; 
                         properties: 
"color"
                         to: 
"green"
                         duration: 
100
                    }

                    NumberAnimation 
                    {
                         id: animateOpacity
                         target: flag
                         properties: 
"opacity"
                         from: 
0.99
                         to: 
1.0
                         loops: Animation.Infinite
                         easing {type: Easing.OutBack; overshoot: 
500}
                    }

                    PropertyAnimation on height{to: 
24 ;duration:600; loops:Animation.Infinite }
                } 
            }
        }
        
        Rectangle
        {
            id: desc
            width: 
486
            height: 
0
            property 
int colorIndex: Math.floor(Math.random()*5)
            color: window.colorArray[colorIndex]
            border.color: Qt.lighter(color)
            
            Text
            {
                anchors.centerIn: parent
                color: 
"#f0f0f0"
                font.pixelSize: 
18
                text: qsTr(
"描述信息")
            }

            PropertyAnimation on height{to: 
32 ;duration:600; loops:Animation.Infinite }
        }

        Rectangle
        {
            id: detail
            width: 
486
            height: 
0
            property 
int colorIndex: Math.floor(Math.random()*5)
            color: window.colorArray[colorIndex]
            border.color: Qt.lighter(color)
            
            Text
            {
                id: text
                anchors.centerIn: parent
                color: 
"#f0f0f0"
                font.pixelSize: 
18
                text: qsTr(
"点击展开")
            }

            MouseArea  
            {  
                anchors.fill: parent  
   
                onReleased:
                {
                    text.text 
= row.visible == true ? qsTr("点击展开") : qsTr("点击折叠")
                    row.visible 
= row.visible == true ? false : true
                } 
            }  

            PropertyAnimation on height{to: 
32 ;duration:600; loops:Animation.Infinite }
        }  

        Row
        {
            id: row
            visible: 
false
            spacing: 
2
            
            Rectangle
            {
                id: d1
                width: 
120
                height: 
32
                property 
int colorIndex: Math.floor(Math.random()*5)
                color: window.colorArray[colorIndex]
                border.color: Qt.lighter(color)
                Text
                {
                    anchors.centerIn: parent
                    color: 
"#f0f0f0"
                    font.pixelSize: 
18
                    text: qsTr(
"WPS表单")
                }
            }
            Rectangle
            {
                id: d2
                width: 
120
                height: 
32
                property 
int colorIndex: Math.floor(Math.random()*5)
                color: window.colorArray[colorIndex]
                border.color: Qt.lighter(color)
                Text
                {
                    anchors.centerIn: parent
                    color: 
"#f0f0f0"
                    font.pixelSize: 
18
                    text: qsTr(
"WPS表单")
                }
            }
            Rectangle
            {
                id: d3
                width: 
120
                height: 
32
                property 
int colorIndex: Math.floor(Math.random()*5)
                color: window.colorArray[colorIndex]
                border.color: Qt.lighter(color)
                Text
                {
                    anchors.centerIn: parent
                    color: 
"#f0f0f0"
                    font.pixelSize: 
18
                    text: qsTr(
"WPS表单")
                }
            }
        }
    }

posted on 2015-11-03 19:37 ccsdu2009 阅读(381) 评论(0)  编辑 收藏 引用 所属分类: QT编程

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理