import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick.Controls 1.4
Window {
visible: true
title: qsTr("Hello World")
minimumWidth: 640
maximumWidth: 640
minimumHeight: 260
maximumHeight: 260
/*
Window {
id: inletSettingPanel
title: "新窗口"
minimumWidth: 270; minimumHeight: 660
}
Button
{
x: parent.x
y: parent.y
width: contentItem.width
height: 15
activeFocusOnTab: false
text: "打开新窗口"
//可在此类中设置需要显示的窗口的大小等属性
onClicked:
{
inletSettingPanel.show();
}
}
*/
/*
Window{
id: _sub
width: 300
height: 300
color: Qt.lighter("gray")
title: qsTr("这是子窗口")
}
Button{
text: "子窗口"
onClicked: _sub.visible=!_sub.visible
}
*/
Loader{
id:loader
}
Component {
id: _sub
Window {
id: win
title: "sub Window"
minimumWidth: 550
maximumWidth: 550
minimumHeight: 400
maximumHeight: 400
visible: true
color: "gray"
// ApplicationModal: 模态
modality: Qt.NonModal /// 非模态
MouseArea {
anchors.fill: parent
onClicked: close();
}
Connections {
target: win
onClosing: {
loader.sourceComponent = undefined;
}
}
Rectangle {
id: _rightUp
width: 50
// height: 100
// width: parent.width/2
height: parent.height/2
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
anchors.topMargin: 10
color: "red"
}
Rectangle {
id: _rightDown
width: 50
// height: 100
// width: parent.width/2
height: _ex.height
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: _rightUp.bottom
anchors.topMargin: 10
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
color: "red"
}
Grid {
id: _ex
spacing: 20
anchors.top: parent.top
anchors.topMargin: 20
anchors.left: _rightUp.right
anchors.leftMargin: 10
anchors.bottom: _rightUp.bottom
anchors.bottomMargin: 20
rows: 4
columns: 4
// 1
Label {
id: _lable1
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lable1value
text: qsTr("20.01")
}
Label {
id: _lable2
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lable2value
text: qsTr("20.02")
}
// 2
Label {
id: _lable11
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lable11value
text: qsTr("20.01")
}
Label {
id: _lable12
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lable12value
text: qsTr("20.02")
}
// 3
Label {
id: _lable21
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lable21value
text: qsTr("20.01")
}
Label {
id: _lable22
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lable22value
text: qsTr("20.02")
}
// 4
Label {
id: _lable31
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lable31value
text: qsTr("20.01")
}
Label {
id: _lable32
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lable32value
text: qsTr("20.02")
}
}
Button {
id: _okButton
text: qsTr("发送")
anchors.top: parent.top
anchors.topMargin: 10
anchors.left: _ex.right
anchors.leftMargin: 30
height: _ex.height
onClicked: {
console.log("begin to send")
}
}
Grid {
id: _ey
spacing: 20
anchors.top: _rightDown.top
anchors.topMargin: 10
anchors.left: _rightDown.right
anchors.leftMargin: 10
anchors.bottom: _rightDown.bottom
anchors.bottomMargin: 10
rows: 4
columns: 4
// 1
Label {
id: _lableRD1
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lableRD1value
text: qsTr("20.01")
}
Label {
id: _lableRD2
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lableRD2value
text: qsTr("20.02")
}
// 2
Label {
id: _lableRD11
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lableRD11value
text: qsTr("20.01")
}
Label {
id: _lable1RD2
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lableRD12value
text: qsTr("20.02")
}
// 3
Label {
id: _lableRD21
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lableRD21value
text: qsTr("20.01")
}
Label {
id: _lableRD22
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lableRD22value
text: qsTr("20.02")
}
// 4
Label {
id: _lableRD31
font.pixelSize: 22
font.italic: true
text: qsTr("par1")
}
TextField {
id: _lableRD31value
text: qsTr("20.01")
}
Label {
id: _lableRD32
font.pixelSize: 22
font.italic: true
text: qsTr("par2")
}
TextField {
id: _lableRD32value
text: qsTr("20.02")
}
}
Button {
id: _okRDButton
text: qsTr("发送")
anchors.top: _ey.top
anchors.topMargin: 10
anchors.left: _ey.right
anchors.leftMargin: 30
height: _ey.height
onClicked: {
console.log("begin to send")
}
}
}
}
MouseArea {
anchors.fill: parent
onClicked: {
loader.sourceComponent = _sub;
}
}
TextField {
id: _tetxField
text: qsTr("_textField")
anchors.centerIn: parent
}
}
Qml 子窗体设计
最新推荐文章于 2024-04-12 15:38:35 发布