qt新建一个quick工程,直接改main.qml,不额外添加任何新文件,main.qml如下:
import QtQuick 2.6
import QtQuick.Window 2.2import "./MyQml"Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World1")
MainForm {
anchors.fill: parent
mouseArea.onClicked: {
console.log(qsTr('Clicked on background. Text: "' + textEdit.text + '"'))
}
}
Item
{
visible: true
width: 640
height: 480
anchors.fill: parent
Rectangle{
id:myRectangle1
anchors.fill: parent
color: "red"
}
}
预期很简单,就是要一个窗口,里面全是红色
import QtQuick 2.6
import QtQuick.Window 2.2import "./MyQml"Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World1")
MainForm {
anchors.fill: parent
mouseArea.onClicked: {
console.log(qsTr('Clicked on background. Text: "' + textEdit.text + '"'))
}
}
Item
{
visible: true
width: 640
height: 480
anchors.fill: parent
Rectangle{
id:myRectangle1
anchors.fill: parent
color: "red"
}
}
预期很简单,就是要一个窗口,里面全是红色