首页 > 其他 > 详细

qml 网格布局 Grid

时间:2021-05-16 22:13:52      阅读:23      评论:0      收藏:0      [点我收藏+]
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
//import QtQuick.Layouts 1.3


Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Item {
        id: rootItem
        anchors.fill: parent
        // 网格布局
        Grid {
            anchors.left: parent.left
            anchors.right: parent.right
            id: grid
            columns: 4
            spacing: 2
            padding: 5
            //rows: 3
            Rectangle { color: "red"; width: 50; height: 50 }
            Rectangle { color: "green"; width: 20; height: 50 }
            Rectangle { color: "blue"; width: 30; height: 20 }
            Rectangle { color: "cyan"; width: 10; height: 50 }
            Rectangle { color: "magenta"; width: 30; height: 10 }
        }
    }
}

技术分享图片

qml 网格布局 Grid

原文:https://www.cnblogs.com/lodger47/p/14774351.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!