在qml中也有类似QWidget那样的布局,是采用定位器来进行布局的。
定位器主要包括: 行定位器(Row), 列定位器(Column),Flow(流定位器),Grid(网格定位器)等。
这些定位器的使用其实都还是很简单的,都不用像anchors那样一个个的去布局,只用在其中使用Item就可以了,同时还可以通过他的附加Positioner来获取Item在Row中的位置等。
下面来看下Row布局的使用。
import QtQuick 2.2
Rectangle{
width: 360;
height: 240;
color:"#eeeeee";
id: rootItem;
Text{
id: centerText;
text:"A Signal Text.";
anchors