Uniform widget scaling while window sizing...
-
Hi,
Are you using layouts ?
-
@1XU7 Well, you should. Why would you do placing and resizing widgets manually if you can simply use layouts instead?
@jsulm hi, i dont have problems using layouts.. i like to use them.. just want to get the effect of uniform scaling keeping aspect ratio like the image... my goal is to make my UI the most accessibility possible so when user resizes window it will act somehow a magnifier... layouts is ok for keeping widgets in position.. but i could not find a way to scale them up or down while resizing window...
i could use QResizeEvent and manually scale them, but that is a bit tricky to get them very well arranged after growing.. so i was wondering if there is another way to make it..
thanks.
-
@jsulm hi, i dont have problems using layouts.. i like to use them.. just want to get the effect of uniform scaling keeping aspect ratio like the image... my goal is to make my UI the most accessibility possible so when user resizes window it will act somehow a magnifier... layouts is ok for keeping widgets in position.. but i could not find a way to scale them up or down while resizing window...
i could use QResizeEvent and manually scale them, but that is a bit tricky to get them very well arranged after growing.. so i was wondering if there is another way to make it..
thanks.
@1XU7 You should take a look at:
-
@jsulm hi, i dont have problems using layouts.. i like to use them.. just want to get the effect of uniform scaling keeping aspect ratio like the image... my goal is to make my UI the most accessibility possible so when user resizes window it will act somehow a magnifier... layouts is ok for keeping widgets in position.. but i could not find a way to scale them up or down while resizing window...
i could use QResizeEvent and manually scale them, but that is a bit tricky to get them very well arranged after growing.. so i was wondering if there is another way to make it..
thanks.
@1XU7
Layouts are indeed the way to get Qt to reposition/resize your widgets, and you should read @jsulm's links and start with https://doc.qt.io/qt-6/layout.html too.Just so you are aware: this will do some of what you show in your picture but not necessarily all. For example, you can arrange for
QPushButtons to be allowed to grow both horizontally and vertically if you wish, and the button will grow/shrink. But it won't change the font size like you show, you would have to do that yourself. And although aQLabelwith a picture can grow I'm not sure that the picture will automatically rescale to fit the new size, you may have to do that yourself.
