73 lines
1.6 KiB
QML
73 lines
1.6 KiB
QML
import QtQuick
|
|
|
|
Window {
|
|
id: rootId
|
|
width: 640
|
|
height: 480
|
|
visible: true
|
|
title: qsTr("Hello World")
|
|
property string textToShow: "hello"
|
|
// Text {
|
|
// text: "Hello World!"
|
|
// font.family: "Helvetica"
|
|
// font.pointSize: 24
|
|
// color: "red"
|
|
// anchors.centerIn: parent
|
|
// }
|
|
Row {
|
|
id: row1
|
|
anchors.centerIn: parent
|
|
spacing: 20
|
|
Rectangle {
|
|
id: redRectId
|
|
width: 100
|
|
height: 100
|
|
color: "red"
|
|
radius: 20
|
|
Text {
|
|
id: textId
|
|
anchors.centerIn: parent
|
|
text: rootId.textToShow
|
|
color: "white"
|
|
font.pointSize: 15
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: {
|
|
console.log(textId.text)
|
|
textToShow = "clicked"
|
|
}
|
|
}
|
|
}
|
|
Rectangle {
|
|
id: blueRectId
|
|
width: 100
|
|
height: 100
|
|
color: "blue"
|
|
radius: 20
|
|
}
|
|
Rectangle {
|
|
id: greenRectId
|
|
width: 100
|
|
height: 100
|
|
// radius:
|
|
color: "green"
|
|
radius: 20
|
|
}
|
|
Rectangle {
|
|
width: 100
|
|
height: 100
|
|
color: "dodgerblue"
|
|
radius: 100
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: {
|
|
console.log("Clicked on dodgerblue circle")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|