QML desktop app layout not adapting to window size
-
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
-
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
@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.
-
@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.
@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.
-
@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.
@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?