Warning, /frameworks/syntax-highlighting/autotests/input/highlight.qml is written in an unsupported language. File is not indexed.
0001 import Qt 4.6
0002 pragma Singleton
0003
0004 // some random qml snippets stolen from the qt docs
0005
0006 Rectangle {
0007 important: true
0008 propertyAsdf:
0009 id: container
0010 signalA: bla
0011 property string label
0012 signal clicked
0013 radius: 5; border.color: "black"
0014 color: mouse.pressed ? "steelblue" : "lightsteelblue"
0015 gradient: Gradient {
0016 GradientStop { position: mouse.pressed ? 1.0 : 0.0; color: "steelblue" }
0017 GradientStop { position: mouse.pressed ? 0.0 : 1.0; color: "lightsteelblue" }
0018 }
0019 MouseRegion { id: mouse; anchors.fill: parent; onClicked: container.clicked() }
0020 Text { anchors.fill: parent; text: container.label; anchors.centerIn: parent }
0021 }
0022
0023 Rectangle {
0024 Script {
0025 function calculateMyHeight() {
0026 return Math.max(otherItem.height, thirdItem.height);
0027 }
0028 }
0029
0030 anchors.centerIn: parent
0031 width: Math.min(otherItem.width, 10)
0032 height: calculateMyHeight()
0033 color: { if (width > 10) "blue"; else "red" }
0034 }
0035
0036 Rectangle {
0037 default property color innerColor: "black"
0038 property color innerColor: "black"
0039 property alias text: textElement.text
0040 property alias aliasXYZ: testElement.text
0041 signal bar
0042 signal bar(var blah, string yxcv)
0043 width: 240; height: 320;
0044 width: 100; height: 30; source: "images/toolbutton.sci"
0045 ListView {
0046 anchors.fill: parent
0047 model: contactModel
0048 delegate: Component {
0049 Text {
0050 text: modelData.firstName + " " + modelData.lastName
0051 }
0052 }
0053 }
0054 }
0055
0056 Item {
0057 function say(text) {
0058 console.log("You said " + text);
0059 }
0060 }
0061
0062 /*
0063 * multi line comment
0064 */
0065
0066 // single line comment
0067
0068 import QtQuick 2.0
0069
0070 Rectangle {
0071 property real myNumProp: 0.1e12;
0072 property alias sub.color;
0073 signal mySignal(int arg1, string arg2)
0074 color: "lightsteelblue"
0075 width: 320
0076 height: width/2
0077
0078 Rectangle {
0079 id: sub
0080 width: 0x10
0081 height: 007
0082 objectName: 'single quote'
0083 objectName2: a ? b : c;
0084 }
0085
0086 Rectangle {
0087 // comment
0088 id: sub /* comment */
0089 /* comment */width: 0x10
0090 height /* comment */: 007
0091 objectName: /* comment */ 'single quote'
0092 objectName2: a ? b : c /* comment */;
0093 }
0094 }