IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Saving, Previewing and Printing Forms in Qt Designer

Qt Designer Manual.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

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.

Image non disponible

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:

Image non disponible

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.

Image non disponible

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.

Image non disponible

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.

Image non disponible

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.

Image non disponible

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.

Image non disponible

Saving and Printing the Form

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

Image non disponible

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.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+