2022-08-19 15:59:36 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// Copyright (C) 2021 The Qt Company Ltd.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*!
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \previouspage studio-importing-designs.html
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \page studio-importing-2d.html
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-10 17:10:47 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \nextpage qtquick-fonts.html
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \title Importing 2D Assets
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    You can import 2D assets, such as images, fonts, and sound files, to \QDS to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    use them in your projects.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    To import an asset, drag-and-drop the external file containing the asset from,
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-29 13:58:04 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for example, File Explorer on Windows, to the \uicontrol {2D},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \uicontrol Navigator, or \uicontrol {Code} view. Alternatively, select
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 12:52:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \uicontrol Assets > \inlineimage icons/plus.png
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    and follow the instructions in the \uicontrol {Asset Import} dialog. You can
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    also multiselect several external asset files to drag-and-drop them to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \QDS simultaneously.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 12:52:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    The imported images will appear in \uicontrol Assets.
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-29 13:58:04 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    If you initiate the import by dragging the assets to the \uicontrol {2D} view,
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    they are also added to your projects as image components, and you can view
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-29 13:58:04 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    them in the \uicontrol {2D} and \uicontrol Navigator view. If you drag an
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    external font file to the \uicontrol {2D} view, it will be added to your
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    project as a text component. Other imported assets, such as sound files,
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 12:52:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    will only appear in \uicontrol Assets, and you can then
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    drag-and-drop them to a suitable view.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \section1 Importing Designs From Other Design Tools
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 10:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \image studio-imported-assets.png "UI imported into Qt Design Studio"
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-28 12:55:37 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \QB enables you to export assets and then import them to a \QDS project
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-29 13:58:04 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    as images and QML files for editing in the \l {2D} view. If you make changes
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-14 17:31:17 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    to your design in the design tool that you originally used to create it,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    you can merge the changes into existing QML files without overwriting the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    changes you have made in \QDS. For more information, see
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \l {Exporting from Design Tools}.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \QB exports the designs either as an archive(.qtbridge) or as images with
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    a .metadata file. \QDS support both formats.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    The following instructions use an empty project as an example. For more
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    information about the options you have, see
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \l {Creating Projects}.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    To import the exported assets to \QDS projects:
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \list 1
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-19 11:28:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol File > \uicontrol {New Project} >
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            \uicontrol General > \uicontrol {Empty}. Add \uicontrol {Details} about
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            the project and select \uicontrol Create.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li In \uicontrol Projects, double-click \e Screen01.ui.qml to move to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            the Design mode.
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 12:52:54 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol Assets > \inlineimage icons/plus.png
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-14 17:31:17 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            .
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select the folder where you exported the assets.
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol {Compressed Metadata (*.qtbridge)}  or
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            \uicontrol {Exported Metadata (*.metadata)} in the dropdown menu to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            filter the exported files.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select a the file to import and then select \uicontrol Open.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol Details next to the
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            \uicontrol {Import Paths} field to display the path where the exported
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            assets are imported from.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            \image studio-asset-import.png "Asset Import dialog"
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol Details next to the
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            \uicontrol {Export Paths} field to display the paths to
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            copy the assets to.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li In the \uicontrol QML field, you can change the folder to copy the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            QML files to.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li In the \uicontrol Assets field, you can change the folder to copy
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            the image files to.
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        \li Select the \uicontrol {Create sub directory} check box to import the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            assets in a sub directory inside \uicontrol {Export Paths}.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Deselect the \uicontrol {Import assets} check box if you only want
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            to create QML files.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Deselect the \uicontrol {Generate QML} check box if you only
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            want to import assets.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select the \uicontrol {Merge QML} check box if you have imported the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            assets before and want to merge the changes into existing QML files
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-29 15:57:47 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            instead of overwriting the existing files. See \l {Merging QML Files}.
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        \li Select the \uicontrol {Round off coordinates} check box to round off
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            the position and dimension values to integers in the generated QML files.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select the \uicontrol {Save Logs} check box to write the export logs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            to a text file inside the directory selected in \uicontrol QML export path.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li Select \uicontrol Import to import the QML files and assets. This
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            might take a little while for complex projects.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \endlist
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-06 17:38:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    The imported assets are displayed in \uicontrol Assets as images.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    The components that you specified in the design tool are displayed in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \uicontrol Components > \uicontrol {My Components} as well as in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \uicontrol Projects view as separate QML files. To use them,
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-29 13:58:04 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    drag-and-drop them from \uicontrol Components to the \uicontrol {2D} or
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \l Navigator view.
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    If asset importer conflicts, warnings, and errors are displayed in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \uicontrol {Asset Import} dialog while importing, fix the issues in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    design tool and export the assets again.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-29 15:57:47 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \section2 Merging QML Files
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    When you re-import a QML component, the changes done in \QDS are preserved.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    The QML item changes in the existing QML component are copied to the corresponding
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    QML item in the new component.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    The following rules are observed while merging QML components.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \list
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li While importing, a unique identifier (UUID) is added for each QML item in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            component. The UUID is used to find the corresponding QML item in the existing
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            component.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li New item properties in the existing component are added to the corresponding
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            item in the new component.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li When a QML property is set in both old and new QML item, the property in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            new item remains unchanged. This rule does not apply to binding properties. In case
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            of bindings, changes done in \QDS are preserved.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li New child items are added to the corresponding item in the new component.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        \li QML items for which a corresponding QML item is not found in the existing component,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            are added under the root item of the new component.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    \endlist
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-26 16:36:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    \include qtbridge-tutorial-links.qdocinc qtsketchbridge tutorials
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-01 13:53:45 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-26 09:36:22 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								*/
							 |