qml学习------------GridLayout
来源:互联网 发布:指南针软件诈骗 编辑:程序博客网 时间:2024/06/11 22:20
在qml中,除了定位器,还有另外一套布局,叫做布局管理器。布局管理器和Qt Widgets中的相似,他和定位器不同的是Item会自动调整Item的尺寸来使用界面的大小。这点跟Qt中的布局是完全相同的。
要使用Layouts ,比如引用他的模块
import QtQuick.Layouts 1.1
GirdLayout可以说是布局管理器中最复杂的,RowLayout和ColumnLayout可以说是GridLayout的特例。
下面就来学习下GridLayout吧。
import QtQuick 2.2 import QtQuick.Layouts 1.1Rectangle{ width: 360; height: 240; color:"#eeeeee"; id:rootItem; Text{ id: centerText; text:"A Signal Text."; font.pixelSize: 24; font.bold: true; } function setTextColor(clr){ centerText.color = clr; } GridLayout{ anchors.left: parent.left; anchors.leftMargin: 4; anchors.bottom: parent.bottom; anchors.bottomMargin: 4; rows: 3; columns: 3; rowSpacing: 4; columnSpacing: 4; flow: GridLayout.TopToBottom; ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } ColorPicker{ color:Qt.rgba(Math.random() , Math.random() , Math.random() ); onColorPicked: setTextColor(clr); } }}
其中这个也可以通过flow来调整 是先横向布局还是纵向布局。具体属性是TopToBottom, LeftToRight 。
0 0
- qml学习------------GridLayout
- QML类型说明-GridLayout
- QML中的GridLayout布局
- QML的GridLayout
- JAVA学习--GridLayout
- Android GridLayOut布局学习
- android学习之GridLayout
- GridLayout学习使用
- Android学习之GridLayout
- qml 学习
- QML学习
- GridLayout
- GridLayout
- gridlayout
- GridLayout
- GridLayout
- GridLayout
- gridlayout
- 搭建最简单的SpringMVC框架(使用maven)
- How to remove the action suffix extension in Struts 2
- JS动态添加的属性Form不能提交的问题
- Php move_uploaded_file无法成功
- 换个角度看微软:每年饮料费2300万
- qml学习------------GridLayout
- 结构体struct简介(上)
- 关东升的iOS实战系列图书 《iOS实战:传感器卷(Swift版)》已经上市
- Java程序设计中setFont()函数的用法(转)
- 通过Uid属性控制TextBlock组件的字体颜色
- Pragmatic thinking and learning-Refactor your wetware
- 关于java重载(重载方法匹配优先级)
- C/C++编译的程序占用的内存分配
- eclipse 中各种小图标含义