import Qt 4.6
pragma Singleton
// some random qml snippets stolen from the qt docs
Rectangle {
important: true
propertyAsdf:
id: container
signalA: bla
property string label
signal clicked
radius: 5; border.: "black"
color: mouse. ? "steelblue" : "lightsteelblue"
gradient: Gradient {
GradientStop { position: mouse. ? 1.0 : 0.0; color: "steelblue" }
GradientStop { position: mouse. ? 0.0 : 1.0; color: "lightsteelblue" }
}
MouseRegion { id: mouse; anchors.: parent; onClicked: container.clicked() }
Text { anchors.: parent; text: container.; anchors.: parent }
}
Rectangle {
Script {
function calculateMyHeight() {
return Math.(otherItem., thirdItem.);
}
}
anchors.: parent
width: Math.(otherItem., 10)
height: calculateMyHeight()
color: { if (width > 10) "blue"; else "red" }
}
Rectangle {
default property color innerColor: "black"
property color innerColor: "black"
property alias text: textElement.
property alias aliasXYZ: testElement.
signal bar
signal bar(var blah, string yxcv)
width: 240; height: 320;
width: 100; height: 30; source: "images/toolbutton.sci"
ListView {
anchors.: parent
model: contactModel
delegate: Component {
Text {
text: modelData. + " " + modelData.
}
}
}
}
Item {
function say(text) {
console.log("You said " + text);
}
}
/*
* multi line comment
*/
// single line comment
import QtQuick 2.0
Rectangle {
property real myNumProp: 0.1e12;
property alias sub.color;
signal mySignal(int arg1, string arg2)
color: "lightsteelblue"
width: 320
height: width/2
Rectangle {
id: sub
width: 0x10
height: 007
objectName: 'single quote'
objectName2: a ? b : c;
}
Rectangle {
// comment
id: sub /* comment */
/* comment */width: 0x10
height /* comment */: 007
objectName: /* comment */ 'single quote'
objectName2: a ? b : c /* comment */;
}
}