PDA

View Full Version : Fixed QMainwindow size, Layout question



Nyte
30th January 2013, 09:38
Hello there,

I'm a complete newbie when it comes to QT (only heard about it a week ago when i started a new job). I'm originally a web designer (HTML/CSS, sadly bad in javascript) so the company i started working thought it would be a great idea to let me work on the UI's of their applications as well. Now i've been messing around with QT Designer and have been busy on a general theme-stylesheet that can be used on all future projects. Thought it would be easy since it's a lot like CSS, but much harder since so many stuff like widgets and frames are linked together.

Anyway, drifting offtopic...after getting the stylesheet ready for all the elements, i've been trying to build some User Interfaces for some small tools that the development team is working on and found out that the LayOut component of QT is another..... hard thing to get used too. Usually clicking the GRID layout button makes my UI explode in unexpected ways. So clearly I need some learning to do before i get the hang of it, but there are some deadlines getting close for some of the tools.

Now to my question: I've been working on a small dialog tool and have some trouble getting the layout to work. The layout i build with just drag and dropping looks fine, but when i try to get the layout to work when you resize the mainwindow, it all gets broken. So I thought, why would the enduser even want to resize this window? Why can't I just set the minsize and maxsize the same so the user CAN'T resize it and leave the layout like i drag/dropped it?
This ofcourse would be a (in my opinion) a short-term solution for our small tool applications, but would be an issue when we start to work on our main application which is fullscreen.


TL;DR If I set a fixed window size, do i still need to define the LayOut with the "Layout in a grid" or "Layout horizontally"? Or can i leave it like that for small tools....

Santosh Reddy
30th January 2013, 09:58
TL;DR If I set a fixed window size, do i still need to define the LayOut with the "Layout in a grid" or "Layout horizontally"? Or can i leave it like that for small tools....
If you plan for fixed widget/window size, there is no need to have Layout in widget (QGridLayout/QHorizontalLayout etc). you can just manually position each of the child-widgets inside the parent-widget (from Qt Designer)

Lesiok
30th January 2013, 10:03
Why can't I just set the minsize and maxsize the same so the user CAN'T resize it and leave the layout like i drag/dropped it?
Because on another computer with different defined fonts may look bad. Especially when the default font is larger in size. For example, the caption on the button may be higher than the button.

Nyte
30th January 2013, 11:33
If you plan for fixed widget/window size, there is no need to have Layout in widget (QGridLayout/QHorizontalLayout etc). you can just manually position each of the child-widgets inside the parent-widget (from Qt Designer)

Thank you for the quick answer


Because on another computer with different defined fonts may look bad. Especially when the default font is larger in size. For example, the caption on the button may be higher than the button.

This is something I could think about. thanks


All in all, this is a short term solution. When i got a better understanding how the layout system works, i will most likely recreate the tool with a variable layout.