This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
import Qt 4.7 |
| 2 |
import org.webkit 1.0 |
| 3 |
|
| 4 |
|
| 5 |
Rectangle { |
| 6 |
// cannot the signals be method calls of an object? |
| 7 |
signal sa |
| 8 |
signal sb(int index) |
| 9 |
signal sc(string text) |
| 10 |
|
| 11 |
// if the property is defined here, it can't be re-defined from Python |
| 12 |
//property string htmlContent: "" |
| 13 |
|
| 14 |
id: rect |
| 15 |
width: 420 |
| 16 |
height: 200 |
| 17 |
border.width: 2 |
| 18 |
WebView { |
| 19 |
id: webView |
| 20 |
width: parent.width |
| 21 |
height: parent.height-60 |
| 22 |
y: 60 |
| 23 |
html: htmlContent |
| 24 |
} |
| 25 |
|
| 26 |
// button 1 |
| 27 |
Rectangle { |
| 28 |
height: text.height + 10; width: text.width + 20 |
| 29 |
border.width: 1 |
| 30 |
x: 20 |
| 31 |
y: 20 |
| 32 |
radius: 4 |
| 33 |
smooth: true |
| 34 |
|
| 35 |
MouseArea { |
| 36 |
anchors.fill: parent |
| 37 |
onClicked: testQMLSignals() |
| 38 |
} |
| 39 |
|
| 40 |
Text { |
| 41 |
id: text |
| 42 |
anchors.centerIn:parent |
| 43 |
font.pointSize: 15 |
| 44 |
text: "click me" |
| 45 |
color: "black" |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
function dataReceived(url) { |
| 50 |
console.log("opening "+url); |
| 51 |
webView.html = "wait..." |
| 52 |
webView.url = url |
| 53 |
} |
| 54 |
|
| 55 |
function testQMLSignals() { |
| 56 |
sa(); |
| 57 |
sb(42); |
| 58 |
sc('Foo'); |
| 59 |
} |
| 60 |
} |