2011-12-14 15:07:05 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (c) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-12-14 15:07:05 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator
|
2011-12-14 15:07:05 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Free Documentation License
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file included in the packaging of this
|
|
|
|
|
** file.
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
// NOTE: the sections are not ordered by their logical order to avoid
|
|
|
|
|
// reshuffling the file each time the index order changes (i.e., often).
|
|
|
|
|
// Run the fixnavi.pl script to adjust the links to the index order.
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
|
|
|
|
\contentspage index.html
|
|
|
|
|
\previouspage quick-user-interaction.html
|
|
|
|
|
\page quick-export-to-qml.html
|
|
|
|
|
\nextpage quick-application-logic.html
|
|
|
|
|
|
|
|
|
|
\title 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 \QC for editing. If you edit the file in Adobe
|
|
|
|
|
Photoshop and export it to the same directory again, any changes you made in
|
|
|
|
|
\QC 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.
|
|
|
|
|
|
|
|
|
|
\section1 Conversion Rules
|
|
|
|
|
|
|
|
|
|
The following rules apply to the conversions:
|
|
|
|
|
|
|
|
|
|
\list
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Layer names are used as element names. Spaces and hash marks (#) are
|
2011-12-14 15:07:05 +01:00
|
|
|
replaced with underscore characters to create valid ids for the
|
|
|
|
|
elements.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Layer styles, such as drop shadows, are converted to images.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Offset, size, ordering and opacity are preserved.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Text layers are converted to Text elements, unless you specify that
|
2011-12-14 15:07:05 +01:00
|
|
|
they be converted to Image elements.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Hidden layers can be exported, and their visibility is set to
|
2011-12-14 15:07:05 +01:00
|
|
|
hidden.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li PNG images are copied to the images subirectory.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
\section1 Preparing Files for Conversion
|
|
|
|
|
|
|
|
|
|
To create QML files that are easy to use, prepare the Adobe Photoshop or
|
|
|
|
|
GIMP designs for exporting, as follows:
|
|
|
|
|
|
|
|
|
|
\list
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To minimize the number of elements, minimize the number of layers or
|
2011-12-14 15:07:05 +01:00
|
|
|
use top-level layer groups, because each layer or layer group is
|
|
|
|
|
exported as a Text or Image element.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To make sure that all related elements are exported to the same
|
2011-12-14 15:07:05 +01:00
|
|
|
element, use top-level layer groups.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To determine that some layers are not exported, hide them, and
|
2011-12-14 15:07:05 +01:00
|
|
|
deselect the \gui {Export hidden} check box during exporting.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To make it easier to find the layers and layer groups after
|
2011-12-14 15:07:05 +01:00
|
|
|
exporting them, use descriptive names for them.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To make sure that image dimensions are preserved during export,
|
2011-12-14 15:07:05 +01:00
|
|
|
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.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To prevent errors during export, make sure that the layers are not
|
2011-12-14 15:07:05 +01:00
|
|
|
locked. Locked layers cannot be exported.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To avoid unexpected results, do not use Blending Mode effects. They
|
2011-12-14 15:07:05 +01:00
|
|
|
are not exported.
|
|
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
\section1 Exporting from Adobe Photoshop to QML
|
|
|
|
|
|
|
|
|
|
\image qml-export-photoshop.png
|
|
|
|
|
|
|
|
|
|
The script has been tested to work on Adobe Photoshop CS 4 and 5, but it
|
|
|
|
|
might also work on other versions.
|
|
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Download the export script, \e{Export QML.jx}, from
|
2011-12-14 15:07:05 +01:00
|
|
|
\l{http://qt.gitorious.org/qt-labs/photoshop-qmlexporter/trees/master}
|
|
|
|
|
{Gitorious}.
|
|
|
|
|
|
|
|
|
|
\note Read the README.txt file in the repository for latest
|
|
|
|
|
information about the script.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Double-click the export script to add the export command to the
|
2011-12-14 15:07:05 +01:00
|
|
|
\gui Scripts menu. You can also copy the script file to the Adobe
|
|
|
|
|
Photoshop scripts directory (typically, \c{\Presets\Scripts} in the
|
|
|
|
|
Photoshop installation directory).
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In Adobe Photoshop, choose \gui {File > Scripts > Export to QML} to
|
2011-12-14 15:07:05 +01:00
|
|
|
export the scene to a QML file.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In the \gui {Export Document to QML} dialog, enter a name and
|
2011-12-14 15:07:05 +01:00
|
|
|
location for the QML file.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select the \gui {Rasterize text} check box to export text layers as
|
2011-12-14 15:07:05 +01:00
|
|
|
images, not as Text elements.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select the \gui {Group layers} check box to export each top-level
|
2011-12-14 15:07:05 +01:00
|
|
|
group as a merged QML Image element.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select the \gui {Export hidden} check box to export hidden layers
|
2011-12-14 15:07:05 +01:00
|
|
|
and to set their visibility property to hidden.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Deselect the \gui {Export QML} check box if you have modified the
|
2011-12-14 15:07:05 +01:00
|
|
|
QML document in \QC, but still want to re-export graphical assets.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Click \gui Export.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
The QML file is saved to the location that you specified. In \QC, choose
|
|
|
|
|
\gui {File > Open File or Project} to open the QML file.
|
|
|
|
|
|
|
|
|
|
\note Existing files are replaced without warning.
|
|
|
|
|
|
|
|
|
|
\section1 Exporting from GIMP to QML
|
|
|
|
|
|
|
|
|
|
\image qml-export-gimp.png
|
|
|
|
|
|
|
|
|
|
The script has been tested to work on GIMP 2. You can download GIMP 2 from
|
|
|
|
|
\l{http://www.gimp.org/downloads/}{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.
|
|
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li On Microsoft Windows, you must first add Python support to your GIMP
|
2011-12-14 15:07:05 +01:00
|
|
|
installation, as instructed in
|
|
|
|
|
\l {http://www.gimpusers.com/tutorials/install-python-for-gimp-2-6-windows}
|
|
|
|
|
{Tutorial: Installing Python for GIMP 2.6 (Windows)}.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Download the export script, \e qmlexporter.py, from
|
2011-12-14 15:07:05 +01:00
|
|
|
\l{http://qt.gitorious.org/qt-labs/gimp-qmlexporter/trees/master}
|
|
|
|
|
{Gitorious}.
|
|
|
|
|
|
|
|
|
|
\note Read the INSTALL.txt in the repository for latest information
|
|
|
|
|
about the script.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Copy the export script to the plug-ins directory in the GIMP
|
2011-12-14 15:07:05 +01:00
|
|
|
installation directory.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Check the properties of the file to make sure that it is executable.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
|
|
|
|
On Linux, run the following command: \c {chmod u+rx}
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Restart GIMP to have the export command added to the \gui File menu.
|
2011-12-14 15:07:05 +01:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Choose \gui {File > Export to QML} to export the design to a QML
|
2011-12-14 15:07:05 +01:00
|
|
|
file.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In the \gui {Export Layers to a QML Document} dialog, enter a name
|
2011-12-14 15:07:05 +01:00
|
|
|
and location for the QML file, and click \gui Export.
|
|
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
The QML file is saved to the location that you specified. In \QC, choose
|
|
|
|
|
\gui {File > Open File or Project} to open the QML file.
|
|
|
|
|
|
|
|
|
|
\note Existing files are replaced without warning.
|
|
|
|
|
|
|
|
|
|
*/
|