QML布局中元素的自动换行
如果下一个元素的宽度超过指定布局的宽度,是否有QML布局或某些配置会自动将QML项包装到下一行 当我使用a时,项目刚好离开窗口边缘并被剪裁:QML布局中元素的自动换行,qml,qt5,qtquick2,Qml,Qt5,Qtquick2,如果下一个元素的宽度超过指定布局的宽度,是否有QML布局或某些配置会自动将QML项包装到下一行 当我使用a时,项目刚好离开窗口边缘并被剪裁: GridLayout { id: header_focused_container; width: parent.width; anchors.margins: 20; Text { text: "header_focused_container.width=" + header_f
GridLayout {
id: header_focused_container;
width: parent.width;
anchors.margins: 20;
Text {
text: "header_focused_container.width=" +
header_focused_container.width +
" and my width is =" + width
}
Rectangle { height:20; width:250; color: "red" }
Rectangle { height:20; width:250; color: "blue" }
Rectangle { height:20; width:250; color: "green" }
}
当我看Qt的文档页面时,我看到了非常手动的缩放。基本上,他们建议我需要计算所需的列
是否有某种布局类型或配置可以自动包装项目?您可以使用:
完美的谢谢我知道这样的事情会存在。
import QtQuick 2.5
import QtQuick.Window 2.0
Window {
visible: true
width: 400
height: 200
Flow {
id: header_focused_container
anchors.fill: parent
Text {
text: "blah"
}
Rectangle { height:20; width:250; color: "red" }
Rectangle { height:20; width:250; color: "blue" }
Rectangle { height:20; width:250; color: "green" }
}
}