简体   繁体   中英

Qt Designer can't reference ApplicationWindow size

This is my first post here in stackoverflow so I'm having a hard time even explaining the issue.

I started to develop a UI for my App in Qt Designer and the Creator. With concerns for Scalability I design all my app pages to parent the ApplicationWindow widgth and height .

This works fine when the app is build but in the Qt Designer the pages have 0 size. So I can't work with them in the Designer.

Is it possible to circumvent that?

here is a code example:

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

When the app is built it works fine specially with regards to Scalability. The problem is with the designer:

在此处输入图片说明

Page 's do have the anchor.fill property, set it from the Text Editor (not from the Form Editor ) and get rid of width and height properties:

Page {
   id: p_basicpage
   anchors.fill: parent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM