All Application Resizing
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.
Give more info please, have you used any layout management?
Be sure to use QLayouts throughout (or anchors if using QML) and it should just work (tm).
Edit: Just saw you are using Qt 4.5.x so ignore my QML comment.
I'm a newbie of Qt, I've just put some objects in the mainwindow form with the creator.
How can be used layouts?
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...
I don't use layout, I adjust manually every elements in the form.
In the object tree the widget have a break layout symbol.
If I don't use layout management how can I resize it?
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?
What is in the other program's layout that you cannot achieve with Qt layouts? Do you have a screen shot of what you are trying to achieve?
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
You can use function @ resize @ of widget, but It is not good idea.
Easy rework to layout.
Ok, I see the tutorials and use the layout.
Thanks all for the infos!