-1

我正在使用 Qt 5.12.8,我已经导入

import QtQml.Models 2.2 
import QtQuick 2.7 
import QtQuick.Controls 2.2 
import QtQuick.Layouts 1.3 

但我收到此错误:invalid property name 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
    }
}
4

1 回答 1

1

我猜你想为 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
    }
}
于 2020-07-04T16:10:13.680 回答