QML RowLayout

来源:互联网 发布:java构造器怎么理解 编辑:程序博客网 时间:2024/06/16 20:46
import QtQuick 2.4import QtQuick.Window 2.2import QtQuick.Controls 1.2import QtQuick.Controls.Styles 1.2import QtQuick.Layouts 1.1Window {    visible: true  //window必须要设置visible属性 不然就不 显示(重点)    title:"RowLayout--涵涵"    RowLayout {        id: layout        anchors.fill: parent        spacing: 6        Rectangle {            color: 'teal'            Layout.fillWidth: true            /****fillWidth设置为true                宽度就会在最小值和最大值之间变化,否则就是preferredwidth                fillHeight同理            ******/            Layout.minimumWidth: 50            Layout.preferredWidth: 100            Layout.maximumWidth: 300            Layout.minimumHeight: 150            Text {                anchors.centerIn: parent                text: parent.width + 'x' + parent.height            }        }        Rectangle {            color: 'plum'            Layout.fillWidth: true            Layout.minimumWidth: 100            Layout.preferredWidth: 200            Layout.preferredHeight: 100            Text {                anchors.centerIn: parent                text: parent.width + 'x' + parent.height            }        }    }}

0 0
原创粉丝点击