这是我在stackoverflow中的第一篇文章,所以我很难解释这个问题。
我开始在Qt Designer和Creator中为我的应用程序开发UI。考虑到可伸缩性,我将所有应用程序页面设计为ApplicationWindow widgth和height的父级。
这在构建应用程序时工作正常但在Qt Designer中页面的大小为0。所以我无法在Designer中使用它们。
有可能绕过那个吗?
这是一个代码示例:
main.qml
ApplicationWindow {
id: main_window
visible: true
width: 450
height: 700
minimumWidth: 450
minimumHeight: 700
Page1.Form.ui.qml
Page {
id: p_basicpage
width: ApplicationWindow.width
height: ApplicationWindow.height
构建应用程序时,它在可伸缩性方面特别有效。问题在于设计师:
Page
确实有anchor.fill
属性,从文本编辑器(而不是Form Editor
)设置它并摆脱width
和height
属性:
Page {
id: p_basicpage
anchors.fill: parent