我正在使用Qt 5.12.8,我已经导入
了import QtQml.Models 2.2
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
但是我收到此错误:无效的属性名称minX(M16(。有人可以指导我什么是我的错误!!
NewWindow {
id: newWindow
visible: !privateVars.isLoading && !privateVars.isEditing
x: (maxX-minX)/2
y: (maxY-minY)/2
minX: -parent.x //ERROR invalid property name minX (M16)
maxX: monitor.width - width - parent.x - additionalToolbarRightMargin -25 //ERROR invalid property name maxX (M16)
minY: -parent.y //ERROR invalid property name minY (M16)
maxY: monitor.height - height -parent.y //ERROR invalid property name maxY (M16)
onLoadClicked: privateVars.isLoading = true
//selectedMissionInstance: loadMissionWindow.selectedMissionInstance
onNewClicked:
{
//Create new mission in missionmodel and go to edit view
missionPlanningModel.newMissionClicked()
privateVars.isEditing = true
}
}
我想你想为NewWindow创建一个变量minX/minY/etc,而不是为现有的变量设置一个值。 如果是这样,您应该声明它。诸如此类:
NewWindow {
id: newWindow
visible: !privateVars.isLoading && !privateVars.isEditing
x: (maxX-minX)/2
y: (maxY-minY)/2
property int minX: -parent.x //Now it's not firing an error
property int maxX: monitor.width - width - parent.x - additionalToolbarRightMargin -25
property int minY: -parent.y
property int maxY: monitor.height - height -parent.y maxY (M16)
onLoadClicked: privateVars.isLoading = true
//selectedMissionInstance: loadMissionWindow.selectedMissionInstance
onNewClicked:
{
//Create new mission in missionmodel and go to edit view
missionPlanningModel.newMissionClicked()
privateVars.isEditing = true
}
}