import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Window 2.1

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar{
        Menu{
            title: qsTr("File")
            MenuItem{
                text: qsTr("EXIT")
                onTriggered: Qt.quit()
            }
        }
    }

    Column{
        spacing: 10
        //button
        Button{
            x:10;y:10;width: 140
            text:qsTr("Button with menu")
            menu:Menu{
                MenuItem{text:qsTr("Item1")}
                MenuItem{text:qsTr("Item2")}
            }
        }
        //radiobutton
        ExclusiveGroup{id:group}
        RadioButton{
            text:qsTr("from top")
            exclusiveGroup: group
            checked: true
        }
        RadioButton{
            text:qsTr("from cursor")
            exclusiveGroup: group
        }
        //switch
        Switch{checked: true}
        Switch{checked: false}
        //combobox
        ComboBox{
            id:editableCombo
            editable: true
            model: ListModel{
                id:model
                ListElement{ text:"Banana";color:"Yellow"}
                ListElement{ text:"Apple";color:"Green"}
                ListElement{ text:"Cocont";color:"Brown"}
            }
            onAccepted: {
                if(editableCombo.find(currentText) === -1){
                    model.append({text:editText})
                    currentIndex = editableCombo.find(editText)
                }
            }
        }
        //spinbox
        SpinBox{
            minimumValue: -5;maximumValue: 10
            prefix: "today";suffix: "degree"
            decimals: 1;stepSize: 1
        }
        //TextField
        TextField{
            width: 200
            placeholderText: "写字写字"
            echoMode: TextInput.PasswordEchoOnEdit
        }
        TextField{width: 200}
        //TextArea
        TextArea{
            width: 240
            textFormat: TextEdit.RichText
            font.pointSize: 13
            text: "<b>Hello</b><i>world!</i>"
        }
        TextArea{
            width: 240
            textFormat: TextEdit.PlainText
            font.pointSize: 13
            text: "<b>Hello</b><i>world!</i>"
        }
        //BusyIndicator
        BusyIndicator{
            running: true
        }
        //ProgressBar
        ProgressBar{
            id:progressBar
            minimumValue: 0
            maximumValue: 100
        }
        Timer{
            interval: 100
            running: true
            repeat: true
            onTriggered: progressBar.value++
        }
    }

}


同样的道理,它在android上也有很好的实现



附件列表

QTQuick控件基础(2)的更多相关文章

  1. QTQuick控件基础(1)

    一.Item QtQuick所有的可视项目都继承自Item,它定义了可视化项目所有通用特性(x\y\width\height\anchors等)具体包括 1.作为容器 2.不透明性 没有设置opaci ...

  2. QTQuick控件基础(3)视图

    1.spliteview 2.stackview ApplicationWindow {visible: truewidth: 640height: 480MouseArea{anchors.fill ...

  3. 重新想象 Windows 8 Store Apps (17) - 控件基础: Measure, Arrange, GeneralTransform, VisualTree

    原文:重新想象 Windows 8 Store Apps (17) - 控件基础: Measure, Arrange, GeneralTransform, VisualTree [源码下载] 重新想象 ...

  4. 重新想象 Windows 8 Store Apps (16) - 控件基础: 依赖属性, 附加属性, 控件的继承关系, 路由事件和命中测试

    原文:重新想象 Windows 8 Store Apps (16) - 控件基础: 依赖属性, 附加属性, 控件的继承关系, 路由事件和命中测试 [源码下载] 重新想象 Windows 8 Store ...

  5. Delphi XE2 之 FireMonkey 入门(44) - 控件基础: TTreeView、TTreeViewItem

    Delphi XE2 之 FireMonkey 入门(44) - 控件基础: TTreeView.TTreeViewItem TScrollBox -> TCustomTreeView -> ...

  6. Delphi XE2 之 FireMonkey 入门(43) - 控件基础: TStringGrid、TGrid

    Delphi XE2 之 FireMonkey 入门(43) - 控件基础: TStringGrid.TGrid TStringGrid.TGrid 都是从 TCustomGrid 继承; 区别有:1 ...

  7. Delphi XE2 之 FireMonkey 入门(42) - 控件基础: TComboBox、TComboEdit

    Delphi XE2 之 FireMonkey 入门(42) - 控件基础: TComboBox.TComboEdit TListBox 有两个兄弟 TComboListBox.TComboEditL ...

  8. Delphi XE2 之 FireMonkey 入门(41) - 控件基础: TListBox

    Delphi XE2 之 FireMonkey 入门(41) - 控件基础: TListBox TScrollBox -> TCustomListBox -> TListBox; 其元素项 ...

  9. Delphi XE2 之 FireMonkey 入门(40) - 控件基础: TMemo

    Delphi XE2 之 FireMonkey 入门(40) - 控件基础: TMemo 值得注意的变化: 1.其父类 TScrollBox 的许多特性也很有用处, 如:   Memo1.UseSma ...

随机推荐

  1. MapReduce分组

     分组:相同key的value进行分组  例子:如下输入输出,右边的第一列没有重复值,第二列取得是当第一列相同时第二例取最大值 分析:首先确定<k3,v3>,k3的选择两种方式, 方法1. ...

  2. POJ 2253 - Frogger - [dijkstra求最短路]

    Time Limit: 1000MS Memory Limit: 65536K Description Freddy Frog is sitting on a stone in the middle ...

  3. 11.28JavaScript学习

    JavaScript输出JavaScript通常用于操作HTML元素,如果要访问某个HTML元素,使用document.getElementById(id)方法,使用id属性标识HTML元素 文档输出 ...

  4. .Net Identity OAuth 2.0 SecurityStamp 使用

    起源: 近期帮别人做项目,涉及到OAuth认证,服务端主动使token失效,要使对应用户不能再继续访问,只能重新登陆,或者重新授权. 场景: 这种场景OAuth2.0是支持的,比如用户修改了密码,那所 ...

  5. Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS - buk ...

  6. numpy、pandas、scipy介绍

    https://blog.csdn.net/LOLITA0164/article/details/80195124 numpy简介NumPy(Numeric Python)是一个Python包.它是一 ...

  7. sass不识别中文字符的问题

    进入Koala安装目录,例如:C:\Program Files (x86)\Koala\rubygems\gems\sass-3.4.9\lib\sass 或者 C:\Ruby\lib\ruby\ge ...

  8. git使用简单指南

    参考: https://www.fengerzh.com/git-reset/?utm_source=tool.lu git建库小结 (一)远端:1.在git网站上建设一个远程仓库复制git远程仓库地 ...

  9. sql server 以10分钟分组 统计人数

    请问针对时间段从每天早上7点开始统计每十分钟人 解决思路: 我以前做过一个关于月份的,是说每3个月以分组,其实是一样的.不过可能啊,整体数据量大会有问题.如果你只是求一天的,那绝对没问题.[1]如果只 ...

  10. 迁移到 Linux :入门介绍 | Linux 中国

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/F8qG7f9YD02Pe/article/details/79001952 这个新文章系列将帮你从其 ...