When I run the application I get a reference error message background is not defined. I’m not sure were I messed up. This is happening at line 22 and I really am not understanding what this means. The code is based off the introduction to QT creater doc:
import QtQuick 2.2
Rectangle {
id: root
property bool showDate: true
property bool showSeconds: true
property string currentTime: "17:11"
property string currentDate: "16.08.14"
property real borderPropertion: 0.1
property real dateTextPropertion: 0.5
property string textColor: "red"
height: 240
width: 400
Image {
id: backgrond
source: "/home/phoenix/SwordNote1/content/resources/Images/light_background.png"
fillMode: "Tile"
anchors.fill: parent
onStatusChanged: if (background.status == Image.Error)
console.log (qsTr ("Background image \"") +
source +
qsTr("\"cannot be loaded"))
}
FontLoader {
id: ledFont
source: "/home/phoenix/SwordNote1/content/resources/font/LED_REAL.TTF"
onStatusChanged: if (ledFont.status == FontLoader.Error)
console.log (qsTr ("Font \"") +
source +
qsTr ("\" cannot be loaded"))
}
Column {
id: clockText
anchors.centerIn: parent
spacing: root.height * root.borderPropertion
Text {
id: timeText
text: root.currentTime
font.pixelSize: root.height * root.timeTextProportion
font.family: ledFont.name
font.bold: true
style: Text.Raised
styleColor: "black"
}
Text {
id: dateText
text: currentDate
color: textColor
anchors.horizontalCenter: parent.horizontalCenter
font.family: ledFont.name
font.pixelSize: root.height * root.dateTextPropertion
visible: showDate
style: Text.Raised
styleColor: "black"
}
}
}
↧