Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Exporting Designs from Graphics Software

You can export designs from graphics software, such as Adobe Photoshop and GIMP, to QML files. Each scene is converted into a single QML file with an Image or a Text element for each layer and saved on the development PC. Top-level layer groups are converted into merged QML Image elements.

Note: GIMP does not support grouping, and therefore, each layer is exported as an item in GIMP.

You can open the QML file in Qt Creator for editing. If you edit the file in Adobe Photoshop and export it to the same directory again, any changes you made in Qt Creator are overwritten. However, you can re-export graphical assets without recreating the QML code.

If you create vector graphics with other tools that have an Adobe Photoshop export option, such as Adobe Illustrator, you can export them first to Photoshop and then to QML.

Conversion Rules

The following rules apply to the conversions:

  • Layer names are used as element names. Spaces and hash marks (#) are replaced with underscore characters to create valid ids for the elements.
  • Layer styles, such as drop shadows, are converted to images.
  • Offset, size, ordering and opacity are preserved.
  • Text layers are converted to Text elements, unless you specify that they be converted to Image elements.
  • Hidden layers can be exported, and their visibility is set to hidden.
  • PNG images are copied to the images subirectory.

Preparing Files for Conversion

To create QML files that are easy to use, prepare the Adobe Photoshop or GIMP designs for exporting, as follows:

  • To minimize the number of elements, minimize the number of layers or use top-level layer groups, because each layer or layer group is exported as a Text or Image element.
  • To make sure that all related elements are exported to the same element, use top-level layer groups.
  • To determine that some layers are not exported, hide them, and deselect the Export hidden check box during exporting.
  • To make it easier to find the layers and layer groups after exporting them, use descriptive names for them.
  • To make sure that image dimensions are preserved during export, create at least one fully filled layer (which can be hidden), such as a background layer. If the export script does not find a fully filled layer, it resizes all images to the size of the canvas.
  • To prevent errors during export, make sure that the layers are not locked. Locked layers cannot be exported.
  • To avoid unexpected results, do not use Blending Mode effects. They are not exported.

Exporting from Adobe Photoshop to QML

The script has been tested to work on Adobe Photoshop CS 4 and 5, but it might also work on other versions.

  1. Download the export script, Export QML.jx, from Gitorious.

    Note: Read the README.txt file in the repository for latest information about the script.

  2. Double-click the export script to add the export command to the Scripts menu. You can also copy the script file to the Adobe Photoshop scripts directory (typically, \Presets\Scripts in the Photoshop installation directory).
  3. In Adobe Photoshop, choose File > Scripts > Export to QML to export the scene to a QML file.
  4. In the Export Document to QML dialog, enter a name and location for the QML file.
  5. Select the Rasterize text check box to export text layers as images, not as Text elements.
  6. Select the Group layers check box to export each top-level group as a merged QML Image element.
  7. Select the Export hidden check box to export hidden layers and to set their visibility property to hidden.
  8. Deselect the Export QML check box if you have modified the QML document in Qt Creator, but still want to re-export graphical assets.
  9. Click Export.

The QML file is saved to the location that you specified. In Qt Creator, choose File > Open File or Project to open the QML file.

Note: Existing files are replaced without warning.

Exporting from GIMP to QML

The script has been tested to work on GIMP 2. You can download GIMP 2 from GIMP Downloads.

To use the export script on Microsoft Windows, you also need to install the GIMP Python extension (Python, PyCairo, PyGobject, PyGTK). However, GIMP is not officially supported on Windows, so we cannot guarantee that this will work.

  1. On Microsoft Windows, you must first add Python support to your GIMP installation, as instructed in Tutorial: Installing Python for GIMP 2.6 (Windows).
  2. Download the export script, qmlexporter.py, from Gitorious.

    Note: Read the INSTALL.txt in the repository for latest information about the script.

  3. Copy the export script to the plug-ins directory in the GIMP installation directory.
  4. Check the properties of the file to make sure that it is executable.

    On Linux, run the following command: chmod u+rx

  5. Restart GIMP to have the export command added to the File menu.
  6. Choose File > Export to QML to export the design to a QML file.
  7. In the Export Layers to a QML Document dialog, enter a name and location for the QML file, and click Export.

The QML file is saved to the location that you specified. In Qt Creator, choose File > Open File or Project to open the QML file.

Note: Existing files are replaced without warning.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Labs au hasard

Logo

QMake et au-delà

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtcreator-2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web