Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
行列布局
    import QtQuick 2.2  
    import QtQuick.Controls 1.1 
     
    Item 
    
{
        id
: root
        Column 
        {
            id: buttons
            anchors.centerIn: parent
            spacing: 6
            MyButton
            {
                width:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            
            Row 
            
{
                id
: rows
                spacing: 12
                MyButton
                {
                    width:64
                    height:48
                
}
                MyButton
                
{
                    width
:64
                    height:48
                
}
                MyButton
                
{
                    width
:64
                    height:48
                
}
            }
        }
    }   

格子布局
    import QtQuick 2.2  
    import QtQuick.Controls 1.1 
     
    Item 
    
{
        id
: root
        Grid
        {
            id: buttons
            rows: 3
            columns: 2
            anchors.centerIn: parent
            spacing: 6
            MyButton
            {
                width:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
            
}
            MyButton
            
{
                width
:64
                height:48
                color: "red"
            
}
        }
    }   

MyButton.qml
    import QtQuick 2.2  
    import QtQuick.Controls 1.1  
     
    Rectangle 
    
{ 
        id
: item
        color: "yellow"
        border.color: "blue"
        Text 
        {
            id: text
            anchors.centerIn: parent
            text: "点击我"
        
}
        MouseArea 
        
{
            anchors.fill
: parent
            onClicked: 
            {
                text.text = "我被点击了"
            
}
        }
    }
posted on 2015-08-20 11:47 ccsdu2009 阅读(377) 评论(0)  编辑 收藏 引用 所属分类: QT编程

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