1
寫了一個簡單的QML應用程序,它抱怨我無法爲文本項目設置錨點。無效的屬性分配:「錨」是隻讀屬性
qrc:/main.qml:13 Invalid property assignment: "anchors" is a read-only property
發生了什麼事?
import QtQuick 2.7
import QtQuick.Controls 2.0
ApplicationWindow {
visible: true
width:320; height:240
title: "Driver Confidence"
property real accSpeed: 29.0576
Text {
text: accSpeed.toFixed(0) + " m/s"
anchors: { top:parent.top; left:parent.left }
}
}