我在QtCreator 3.3.1中使用Qt 5.4.1
我已将QtQuick.Controls 1.2导入我的QML并添加了一系列按钮:
Rectangle {
id: buttonBar
x: 480
y: 0
width: 320
height: 80
Button {
x: 0
y: 0
width: 80
height: 60
text: "Songs"
}
Button {
x: 80
y: 0
width: 80
height: 60
text: "Artists"
}
Button {
x: 160
y: 0
width: 80
height: 60
text: "Albums"
}
Button {
x: 240
y: 0
width: 80
height: 60
text: "Back"
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行程序时它们都可以正常运行,但每次QtCreator打开qml文件时它都会跳转到设计模式并收到警告:
invalid property name 'x' (M16)
Run Code Online (Sandbox Code Playgroud)
当我在编辑模式下查看文件时,我使用x,y,宽度和高度的行都加下划线.
但文档说这些是我按钮的有效属性 - http://doc.qt.io/qt-5/qml-qtquick-controls-button-members.html …