All Application Resizing
-
Hi all,
I have write an application for XP in a 1024x768 screen and now I have to resize it on 800x600. How can I do this simply, I have to resize all of the element one by one?
All of the form I have done with Qt Creator 1.2.0 based on Qt 4.5.2.Thanks.
-
Give more info please, have you used any layout management?
-
How to use layouts is described in the doc, e.g. "here":http://doc.qt.nokia.com/4.7/layout.html
Although, if you press F1 in QtCreator you will get the online help which also describes how to build UIs with layouts in QtCreator.
If you are in the form ui editor, you can select some elements and press on of the layout buttons in the toolbar...
-
Then maybe you should use layouts? They are much easier than the alternative. What is your reason for not using layouts?
If you insist on not using them then you will need to override the resizeEvent() function in your mainwindow and manually position your widgets when your are notified by means of the above virtual function.
I really suggest you look into using layouts.
-
I don't use because I need to copy a particular layout of an other program.
If I use layout I can resize completely the form? For example if I have a text with a font size in a QLabel, the font size is scaled also?
For the manually position and resize of the widgets, is there some function to do this in a loop? For example like the "for each" cycle of the visual basic?
Thanks.
-
Every toolkit has its own means of laying out items. It's not a very clever idea to force the habits of another toolkit into the new. Better adapt to the new ons. In case of Qt and designer, this is using layouts. There are good tutorials in the docs:
- "Layout Management":http://doc.qt.nokia.com/latest/layout.html for a general introduction
- "A Quick Start to Qt Designer":http://doc.qt.nokia.com/latest/designer-quick-start.html
- "Designer Manual":http://doc.qt.nokia.com/latest/designer-manual.html
- "Using Layouts in Qt Designer":http://doc.qt.nokia.com/latest/designer-layouts.html