QML基本元素使用范例-Grid

main.qml

import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1

import QtQuick.Dialogs 1.2

Window {
    visible: true
    width: 800
    height: 600
    title: qsTr("")

Grid{
    x: 10
    y: 50
    columns: 2
    spacing: 5

COM_TableItem{
}
COM_TableItem{
}
COM_TableItem{
}
COM_TableItem{
}
COM_TableItem{
}
COM_TableItem{
}
}
}

COM_TableItem.qml

import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle {
    width: 60
    height: 60
    border.color: "red"

Rectangle{
    id: label
    border.color: "green"
    //
    width:  20
    height: 10

}
Rectangle{
    id: textInput
    border.color: "blue"
    //
    y: label.width + 10
    width:  20
    height: 10
}
}

猜你喜欢

转载自blog.csdn.net/qq_43248127/article/details/91353959