Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML desktop app layout not adapting to window size
Forum Updated to NodeBB v4.3 + New Features

QML desktop app layout not adapting to window size

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 656 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjsmithers
    wrote on last edited by mjsmithers
    #1

    Hi,

    I've been working with QWidgets for years and am now trying QML layouts using the QT Design Studio. When I start a new desktop project, the highest level object is a rectangle. I have figured out how to use positioners to create the layouts I'm accustomed to with QWidgets, in Qt Creator.

    However when I run the app, the highest level rectangle size stays fixed and consequently the layouts stay fixed, regardless of the window size. If I make the window smaller, the contents just is just cropped.

    I can't find any setting in Qt Design Studio (3.9.0) to make the top level rectangle resize with the window size.

    Am I missing something simple?

    Michael

    B 1 Reply Last reply
    0
    • M mjsmithers

      Hi,

      I've been working with QWidgets for years and am now trying QML layouts using the QT Design Studio. When I start a new desktop project, the highest level object is a rectangle. I have figured out how to use positioners to create the layouts I'm accustomed to with QWidgets, in Qt Creator.

      However when I run the app, the highest level rectangle size stays fixed and consequently the layouts stay fixed, regardless of the window size. If I make the window smaller, the contents just is just cropped.

      I can't find any setting in Qt Design Studio (3.9.0) to make the top level rectangle resize with the window size.

      Am I missing something simple?

      Michael

      B Offline
      B Offline
      Bob64
      wrote on last edited by
      #2

      @mjsmithers you just need to bind your top level rectangle to the window dimensions. Either by binding the height and width or using anchors as elsewhere. There is nothing special that is done automatically just because it is a direct child of your main window.

      M 1 Reply Last reply
      0
      • B Bob64

        @mjsmithers you just need to bind your top level rectangle to the window dimensions. Either by binding the height and width or using anchors as elsewhere. There is nothing special that is done automatically just because it is a direct child of your main window.

        M Offline
        M Offline
        mjsmithers
        wrote on last edited by
        #3

        @Bob64 Thx. Anchors can't be set for the top level rectangle - they're greyed out. And there isn't a window property in the bindings list; there's just a just of the existing object plus "constants." If I bind to the constant.width and constant.height, again the contents of the app doesn't resize with the window size.

        B 1 Reply Last reply
        0
        • M mjsmithers

          @Bob64 Thx. Anchors can't be set for the top level rectangle - they're greyed out. And there isn't a window property in the bindings list; there's just a just of the existing object plus "constants." If I bind to the constant.width and constant.height, again the contents of the app doesn't resize with the window size.

          B Offline
          B Offline
          Bob64
          wrote on last edited by
          #4

          @mjsmithers sorry, I had missed that you were using Design Studio. I'm afraid I have never used it so I can't help. Is there any way to hand edit what it generates?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved