W3cubDocs

/Qt

Saving, Previewing and Printing Forms in Qt Designer

Although Qt Designer's forms are accurate representations of the components being edited, it is useful to preview the final appearance while editing. This feature can be activated by opening the Form menu and selecting Preview, or by pressing Ctrl+R when in the form.

The preview shows exactly what the final component will look like when used in an application.

Since Qt 4.4, it is possible to preview forms with various skins - default skins, skins created with Qt Style Sheets or device skins. This feature simulates the effect of calling QApplication::setStyleSheet() in the application.

To preview your form with skins, open the Edit menu and select Preferences...

You will see the dialog shown below:

The Print/Preview Configuration checkbox must be checked to activate previews of skins. You can select the styles provided from the Style drop-down box.

Alternatively, you can preview custom style sheet created with Qt Style Sheets. The figure below shows an example of Qt Style Sheet syntax and the corresponding output.

Another option would be to preview your form with device skins. A list of generic device skins are available in Qt Designer, however, you may also use other QVFB skins with the Browse... option.

Viewing the Form's Code

Since Qt 4.4, it is possible to view code generated by the User Interface Compiler (uic) for the Qt Designer form.

Select View Code... from the Form menu and a dialog with the generated code will be displayed. The screenshot below is an example of code generated by the uic.

Saving and Printing the Form

Forms created in Qt Designer can be saved to an image or printed.

Saving Forms

To save a form as an image, choose the Save Image... option. The file will be saved in .png format.

Printing Forms

To print a form, select the Print... option.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/designer-preview.html