2020-12-11 14:33:15 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2021-02-03 19:08:19 +01:00
|
|
|
** Copyright (C) 2021 The Qt Company Ltd.
|
2020-12-11 14:33:15 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of the Qt Bridge documentation.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU Free Documentation License Usage
|
|
|
|
|
** 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. Please review the following information to ensure
|
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\previouspage qtbridge-figma-setup.html
|
|
|
|
|
\page qtbridge-figma-using.html
|
|
|
|
|
\nextpage exporting-3d-assets.html
|
|
|
|
|
|
|
|
|
|
\title Using \QBF
|
|
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
\section1 Organizing Designs
|
2020-12-11 14:33:15 +01:00
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
To get the best results during export and import, follow these guidelines
|
|
|
|
|
when working with Figma:
|
2020-12-11 14:33:15 +01:00
|
|
|
|
|
|
|
|
\list
|
|
|
|
|
\li Use pages for different purposes, such as \e sketching for trying
|
|
|
|
|
out ideas, \e components for creating UI components, \e assets for
|
|
|
|
|
images that you use in the components, and \e screens for building
|
|
|
|
|
the UI screens using components and assets.
|
|
|
|
|
\li Arrange each page into frames. When you are happy with a design,
|
|
|
|
|
move it from the sketching page to the components page and use it
|
|
|
|
|
in screens. When you export your assets, you can skip all frames
|
|
|
|
|
that you don't want to be part of the final UI, to avoid cluttering
|
2021-02-03 19:08:19 +01:00
|
|
|
the \QDS project. The code generated in \QDS corresponds to the
|
2020-12-11 14:33:15 +01:00
|
|
|
structure of your Figma document.
|
|
|
|
|
\li \QBF supports \e {Figma components}. Each Figma component
|
2021-02-03 19:08:19 +01:00
|
|
|
is exported as a \e {\QDS component}, and each Figma component
|
|
|
|
|
instance is generated as a respective component instance in the
|
|
|
|
|
component files generated when you \l{Importing 2D Assets}{import}
|
|
|
|
|
the design into \QDS.
|
2020-12-11 14:33:15 +01:00
|
|
|
\li Create components in Figma and export them to \QDS before you
|
|
|
|
|
start making instances of them. In \QDS, add functionality to the
|
|
|
|
|
components, such as button states and then bring them back to Figma
|
2021-02-03 19:08:19 +01:00
|
|
|
as assets. If you use functional \QDS components in Figma, you will
|
2020-12-11 14:33:15 +01:00
|
|
|
find it easier to merge new iterations of the design to \QDS and
|
|
|
|
|
continue to build the screens there.
|
2021-03-29 16:59:28 +02:00
|
|
|
\li \QBF does not support exporting changes in component instances.
|
|
|
|
|
If you make changes to component instances in Figma, you must
|
|
|
|
|
detach the instances before exporting them. Similarly, if your
|
|
|
|
|
Figma components contain nested components, Figma allows you to
|
|
|
|
|
hot swap the nested instance inside the component instance.
|
2021-03-25 09:50:46 +01:00
|
|
|
However, \QBF doesn't support this so you get the original
|
2021-03-29 16:59:28 +02:00
|
|
|
component unless you detach the component instance before
|
|
|
|
|
exporting it.
|
2021-02-03 19:08:19 +01:00
|
|
|
\li Use descriptive and unique IDs to avoid duplicate IDs after
|
|
|
|
|
exporting designs and importing them to \QDS.
|
2020-12-11 14:33:15 +01:00
|
|
|
\endlist
|
|
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
To use the fonts that you use in Figma also in \QDS, you need to add
|
2020-12-11 14:33:15 +01:00
|
|
|
them to \QDS as assets. \QDS deploys them to devices when you preview the
|
|
|
|
|
UI. For more information, see \l{Using Custom Fonts}.
|
|
|
|
|
|
|
|
|
|
\section2 Using Frames
|
|
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
Frames are exported as components of the \l Rectangle type by default.
|
|
|
|
|
However, if you have applied effects to the frames that \QBF cannot
|
|
|
|
|
handle, such as gradient fill colors or a mixed radius, the frames are
|
|
|
|
|
exported as images.
|
2020-12-11 14:33:15 +01:00
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
\section1 Exporting Designs
|
2020-12-11 14:33:15 +01:00
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
\image qt-figma-bridge.png "Qt Bridge for Figma"
|
2020-12-11 14:33:15 +01:00
|
|
|
|
|
|
|
|
To export your design using \QBF:
|
|
|
|
|
|
|
|
|
|
\list 1
|
2021-02-03 19:08:19 +01:00
|
|
|
\li Specify settings for exporting each group and layer.
|
|
|
|
|
\li Select \uicontrol Export to export your design.
|
|
|
|
|
\li When the exporting is done, select \uicontrol OK.
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
\QBF exports everything into a single archive. Before importing the design
|
|
|
|
|
into \QDS, you have to manually extract the archive. Then you can import the
|
|
|
|
|
\e .metainfo into a project in \QDS, as described in \l{Importing 2D Assets}.
|
|
|
|
|
|
|
|
|
|
\section1 Export Settings
|
|
|
|
|
|
|
|
|
|
You can specify export settings in the \uicontrol Home tab and in the
|
|
|
|
|
\uicontrol Settings tab.
|
|
|
|
|
|
|
|
|
|
\section2 Home
|
|
|
|
|
|
|
|
|
|
You can specify settings for exporting each group and layer.
|
|
|
|
|
|
|
|
|
|
\table
|
|
|
|
|
\header
|
|
|
|
|
\li Name
|
|
|
|
|
\li Purpose
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol ID
|
|
|
|
|
\li \QBF automatically proposes identifiers for all groups and layers.
|
|
|
|
|
You can change them in this field. Use unique and descriptive IDs
|
|
|
|
|
to avoid duplicate IDs when the layer and the respective artwork
|
|
|
|
|
are imported into \QDS.
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol {Export as}
|
|
|
|
|
\li Determines how to export the group or layer:
|
2020-12-11 14:33:15 +01:00
|
|
|
\list
|
|
|
|
|
\li \uicontrol Child exports each asset of the selected group
|
2021-03-30 11:28:11 +02:00
|
|
|
or layer as a separate component file. Images are exported
|
|
|
|
|
as separate files nested in \l{Images}{Image} components.
|
|
|
|
|
You select the image file format in \uicontrol Settings >
|
|
|
|
|
\uicontrol {Asset settings}.
|
|
|
|
|
|
|
|
|
|
Figma rectangles are exported as \l{basic-rectangle}
|
|
|
|
|
{Rectangle} components. Figma vectors are exported as
|
|
|
|
|
\l{SVG Path Item} components from the \l{Shapes}
|
2021-05-17 16:24:14 +02:00
|
|
|
{Qt Quick Studio Components} module.
|
2021-03-30 11:28:11 +02:00
|
|
|
\li \uicontrol Merged merges the selected groups and layers
|
|
|
|
|
into one component.
|
2020-12-11 14:33:15 +01:00
|
|
|
\li \uicontrol Skipped completely skips the selected layer.
|
|
|
|
|
\endlist
|
2021-02-03 19:08:19 +01:00
|
|
|
\row
|
|
|
|
|
\li \uicontrol {Custom Component Type}
|
|
|
|
|
\li Determines the \l{Component Types}{component type} to morph this
|
2020-12-11 14:33:15 +01:00
|
|
|
layer into. The component that is generated during import will be
|
2021-03-30 11:28:11 +02:00
|
|
|
of this type. For example, if you drew a button, you can export
|
|
|
|
|
it as a \l Button component from the Qt Quick Controls module.
|
|
|
|
|
You can provide the import statement of the
|
|
|
|
|
\l{Adding and Removing Modules}{module} where the component
|
|
|
|
|
is defined in the \uicontrol {Imports} field.
|
2021-02-03 19:08:19 +01:00
|
|
|
\row
|
|
|
|
|
\li \uicontrol Properties
|
|
|
|
|
\li Sets values of properties for the component. You can add properties
|
|
|
|
|
and modify their values in \QDS.
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol Imports
|
|
|
|
|
\li If you want to make additional components available in the component
|
2021-03-30 11:28:11 +02:00
|
|
|
file, you can enter the import statements of the modules that
|
|
|
|
|
contain the components in this field. For example, to use components
|
|
|
|
|
from version 2.3 of the Qt Quick Controls module, you need the
|
|
|
|
|
import statement \c {QtQuick.Controls 2.3} and to use version 1.0
|
2021-05-17 16:24:14 +02:00
|
|
|
Qt Quick Studio Components, you need the import statement
|
2021-03-30 11:28:11 +02:00
|
|
|
\c {QtQuick.Studio.Components 1.0}. You can add components from all
|
|
|
|
|
the available modules in \QDS later. You can also import a module as
|
|
|
|
|
an \e alias.
|
2021-02-03 19:08:19 +01:00
|
|
|
\row
|
|
|
|
|
\li \uicontrol Alias
|
|
|
|
|
\li Exports the component generated from this layer as an alias in the
|
|
|
|
|
parent component.
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol Visible
|
|
|
|
|
\li Determines the visibility of the layer.
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol Clip
|
|
|
|
|
\li Enables clipping in the component generated from the layer. The
|
|
|
|
|
generated component will clip its own painting, as well as the
|
|
|
|
|
painting of its children, to its bounding rectangle.
|
|
|
|
|
\endtable
|
2020-12-11 14:33:15 +01:00
|
|
|
|
2021-02-03 19:08:19 +01:00
|
|
|
\section2 Settings
|
|
|
|
|
|
|
|
|
|
\image qt-figma-bridge-settings.png
|
|
|
|
|
|
|
|
|
|
You can export assets in the selected format (JPG, PNG, or SVG).
|
|
|
|
|
|
2021-03-30 11:28:11 +02:00
|
|
|
By default, vectors are exported as \l{SVG Path Item} components from the
|
2021-05-17 16:24:14 +02:00
|
|
|
Qt Quick Studio Components module. This might not work for layers that have
|
2021-03-30 11:28:11 +02:00
|
|
|
particular effects applied to them. In that case, the layers are exported
|
|
|
|
|
as images.
|
|
|
|
|
|
|
|
|
|
Because MCUs only support simple images, disable the
|
|
|
|
|
\uicontrol {Export as shapes} check box when designing for MCUs.
|
2021-02-03 19:08:19 +01:00
|
|
|
|
|
|
|
|
\table
|
|
|
|
|
\header
|
|
|
|
|
\li Name
|
|
|
|
|
\li Purpose
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol {Asset settings}
|
|
|
|
|
\li Exports assets in the selected format (JPG, PNG, or SVG).
|
|
|
|
|
\row
|
|
|
|
|
\li \uicontrol {Export as shapes}
|
2021-03-30 11:28:11 +02:00
|
|
|
\li Exports vectors as components of the type \l{SVG Path Item} from the
|
2021-05-17 16:24:14 +02:00
|
|
|
Qt Quick Studio Components module.
|
2021-02-03 19:08:19 +01:00
|
|
|
\row
|
|
|
|
|
\li \uicontrol {Reset plugin data}
|
|
|
|
|
\li Resets all settings for all layers and groups (also in the
|
|
|
|
|
\uicontrol Home tab) to default values. This means that you
|
|
|
|
|
will lose all your changes to the settings.
|
|
|
|
|
\endtable
|
2020-12-11 14:33:15 +01:00
|
|
|
*/
|