File: qml

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (77 lines) | stat: -rw-r--r-- 1,578 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import QtQuick 2.0
import QtQuick.Controls 1.0 as Controls
import 'logic.js' as Logic

Item {
    // id
    id: root

    // property
    width: 128; height: 64
    enabled: true
    objectName: 'rootItem'
    anchors.centerIn: parent
    // property (spaced)
    opacity  :  1.0

    // property definitions
    property var value
    property int number: 10
    property bool checked: false
    property string text: 'Root Item'
    property var regex: /button/
    property var color: checked ? '#000000' : '#FFFFFF'

    // default property
    default property var textItem

    // signal
    signal pressed
    signal clicked()
    signal clickedAt(int x, int y, string text)

    // object property
    property var object: QtObject {
        objectName: "object"
        property var value
        function action() {
            console.log('action')
        }
    }

    // value source
    NumberAnimation on opacity {
        id: animation
        from: 0.0
        to: 1.0
    }
    // inline object
    Text { text: root.text }

    // qualified type
    Controls.Button { text: 'button' }

    // function
    function startAnimation(duration) {
        animation.duration = duration
        animation.start()
    }

    // signal handler
    onClickedAt: {
        if (x === 10 && y === 10) {
          console.log('clicked at x=10, y=10')
        }
    }

    // attached signal handler
    Component.onCompleted: {
        console.log('completed')
    }

    // states
    states: [
        State { name: 'default' },
        State { name: 'pressed' }
    ]
}