Search code examples
qtqmlqtquick2designer

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:

enter image description here


Solution

  • 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