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. c++从文件中读取一行数据并保存在数组中

    从txt文本中读取数据存入数组中 #include <iostream> #include <fstream> #include <string> #include ...

  2. HDU-2680 Choose the best route 单向边+反向dijkstra

    https://vjudge.net/problem/HDU-2680 题意:以起始点 终点 长度 给出一个图,已知可以从w个起点出发,求从任一起点到同一个终点s的最短路径.注意是单向边.m<1 ...

  3. Unity-反编译由IL生成的DLL文件

        本文由博主SunboyL原创,转载请注明出处:http://www.cnblogs.com/xsln/p/DLL_DeCompilation.html     在Unity实际开发过程中,我们 ...

  4. nodejs(二)child_process模块

    1.child_process是Node.js的一个十分重要的模块,通过它可以实现创建多进程,以利用多核计算资源. child_process模块提供了四个创建子进程的函数,分别是spawn,exec ...

  5. 【Python】Pycharm2018激活方式【亲测好用】

    2.激活码激活 优点:Window.Mac.Ubantu都稳定有效,关键是这种激活方式不会产生其他影响 缺点:需要修改hosts文件 修改hosts文件将0.0.0.0 account.jetbrai ...

  6. (3.10)mysql基础深入——mysqld 服务器与客户端连接过程 源码分析【待写】

    (3.10)mysql基础深入——mysqld 服务器与客户端连接过程 源码分析[待写]

  7. SQLServerDBA十大必备工具---让生活轻松点

    原贴:http://www.cnblogs.com/fygh/archive/2012/04/25/2469563.html 国外整理拓展帖:http://weblogs.sqlteam.com/ml ...

  8. 001-window版redis安装

    一.参考地址 官方地址:https://redis.io/ windows版本[学习使用]:https://github.com/MicrosoftArchive/redis 二.windows版re ...

  9. bootstrap模态框手动开启关闭与设置点击外部不关闭

    http://www.cnblogs.com/qlqwjy/p/7491054.html 完整的参考菜鸟教程:http://www.runoob.com/bootstrap/bootstrap-mod ...

  10. 【Cocos2dx 3.3 Lua】剪裁结点ClippingNode

    参考资料:     http://shahdza.blog.51cto.com/2410787/1561937 http://blog.csdn.net/jackystudio/article/det ...