• QTQuick控件基础(2)


    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上也有很好的实现







    附件列表

    • 相关阅读:
      Cocos2dx-lua开发之c++绑定到lua
      SCOPE_IDENTITY和@@IDENTITY[转]
      c#List结合IEqualityComparer求交集
      K:java中正则表达式的使用说明及其举例
      K:常见的正则表达式
      K:正则表达式之基础简介
      Q:javax.comm 2.0 windows下Eclipse的配置
      Q:同时安装了python2和python3的电脑下pip的使用
      K:java 断言 assert 初步使用:断言开启、断言使用
      请描述一下 cookies,sessionStorage 和 localStorage 的区别
    • 原文地址:https://www.cnblogs.com/jsxyhelu/p/16947944.html
    Copyright © 2020-2023  润新知