forked from qt-creator/qt-creator
Doc: Update info about using Qt Quick modules with plugins
- Some steps are not needed when developing with Qt 6.2 or later. - Removed obsolete information. Task-number: QDS-11794 Change-Id: Ifbfc0bacd50557892ac82658379098123f463a2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -36,22 +36,25 @@
|
|||||||
\list 1
|
\list 1
|
||||||
|
|
||||||
\li Create custom components and place all the \c .qml files in a
|
\li Create custom components and place all the \c .qml files in a
|
||||||
directory dedicated to your module. For example:
|
directory dedicated to your module. For example,
|
||||||
\c {imports\asset_imports}.
|
\c {imports\asset_imports}.
|
||||||
|
|
||||||
\li For Qt Quick UI Prototype projects (.qmlproject), specify the path to
|
\if defined(qtcreator)
|
||||||
|
\li For Qt Quick UI Prototype projects (.qmlproject), specify the path to
|
||||||
the directory that has the module in the .qmlproject file
|
the directory that has the module in the .qmlproject file
|
||||||
of the application where you want to use the module
|
of the application where you want to use the module
|
||||||
as a value of the \c importPaths variable. For example
|
as a value of the \c importPaths variable. For example,
|
||||||
\c{importPaths: [ "imports", "asset_imports" ]}.
|
\c{importPaths: [ "imports", "asset_imports" ]}.
|
||||||
|
\else
|
||||||
|
\li Specify the path to the directory that has the module in the
|
||||||
|
.qmlproject file of the application where you want to use the module
|
||||||
|
as a value of the \c importPaths variable. For example,
|
||||||
|
\c{importPaths: [ "imports", "asset_imports" ]}.
|
||||||
|
\endif
|
||||||
\li Create a \c qmldir file for your module and place it
|
\li Create a \c qmldir file for your module and place it
|
||||||
in the module directory. For more information, see
|
in the module directory. For more information, see
|
||||||
\l {Module Definition qmldir Files}.
|
\l {Module Definition qmldir Files}.
|
||||||
|
|
||||||
\li Create a \c qmltypes file, as instructed in
|
|
||||||
\l {Generating Type Description Files}.
|
|
||||||
|
|
||||||
\li Create a directory named \c designer in your module directory.
|
\li Create a directory named \c designer in your module directory.
|
||||||
|
|
||||||
\li Create a \c .metainfo file for your module and place it in the
|
\li Create a \c .metainfo file for your module and place it in the
|
||||||
@@ -66,23 +69,29 @@
|
|||||||
\if defined(qtcreator)
|
\if defined(qtcreator)
|
||||||
\li Import the module into the project, as instructed in
|
\li Import the module into the project, as instructed in
|
||||||
\l {Importing QML Modules}.
|
\l {Importing QML Modules}.
|
||||||
\endlist
|
|
||||||
|
|
||||||
\note If \QC cannot find the new QML module, build the project
|
|
||||||
and then go to \uicontrol {Tools} > \uicontrol {QML/JS} >
|
|
||||||
\uicontrol {Reset Code Model} to reset the code model.
|
|
||||||
|
|
||||||
\else
|
\else
|
||||||
\li Build your module using the same Qt version and compiler as \QDS.
|
\li Build your module using the same Qt version and compiler as \QDS.
|
||||||
For more information, see \l {Running QML Modules in Design Mode}.
|
|
||||||
|
Your module and components should now appear in \uicontrol Components.
|
||||||
|
\endif
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
Your module should now appear in \uicontrol Components. Your components
|
\note If \QC cannot find the new QML module, build the project
|
||||||
should appear in a subsection of \uicontrol Components if a valid
|
and then go to \uicontrol {Tools} > \uicontrol {QML/JS} >
|
||||||
\c .metainfo file is in place.
|
\uicontrol {Reset Code Model} to reset the code model.
|
||||||
|
\if defined(qtdesignstudio)
|
||||||
|
For more information about how to show the \uicontrol {Tools} menu, see
|
||||||
|
\l{Customizing the Menu}.
|
||||||
\endif
|
\endif
|
||||||
|
|
||||||
\section1 Generating Type Description Files
|
\if defined(qtcreator)
|
||||||
|
\section1 Developing with Qt 6.1 or Earlier
|
||||||
|
|
||||||
|
Since Qt 6.2, CMake generates the \c qmltypes and \c qmldir files
|
||||||
|
automatically.
|
||||||
|
|
||||||
|
\section2 Generating Type Description Files
|
||||||
|
|
||||||
When \l{Defining QML Types from C++}{registering QML types}, make sure that
|
When \l{Defining QML Types from C++}{registering QML types}, make sure that
|
||||||
the QML module has a \c{plugins.qmltypes} file. Ideally, it should be located
|
the QML module has a \c{plugins.qmltypes} file. Ideally, it should be located
|
||||||
@@ -115,6 +124,7 @@
|
|||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
The import path affects all the targets built by the CMake project.
|
The import path affects all the targets built by the CMake project.
|
||||||
|
\endif
|
||||||
|
|
||||||
\if defined(qtdesignstudio)
|
\if defined(qtdesignstudio)
|
||||||
\section1 Running QML Modules in Design Mode
|
\section1 Running QML Modules in Design Mode
|
||||||
@@ -138,15 +148,6 @@
|
|||||||
in the \uicontrol Design mode. You can use the value of the \c QML_PUPPET_MODE
|
in the \uicontrol Design mode. You can use the value of the \c QML_PUPPET_MODE
|
||||||
environment variable to check whether the plugin is currently being run
|
environment variable to check whether the plugin is currently being run
|
||||||
by an application or edited in the \uicontrol Design mode.
|
by an application or edited in the \uicontrol Design mode.
|
||||||
|
|
||||||
If you want to use a different module in the \uicontrol Design mode
|
|
||||||
than in your actual application for example to mockup C++ items,
|
|
||||||
you can use \c{QML_DESIGNER_IMPORT_PATH}
|
|
||||||
in the \c{.pro} file (for qmake projects), or declare and set the property
|
|
||||||
\c qmlDesignerImportPaths in your product (for Qbs projects).
|
|
||||||
Modules in the import paths defined in \c{QML_DESIGNER_IMPORT_PATH} will be
|
|
||||||
used only in the \uicontrol Design mode.
|
|
||||||
For an example, see \l {Qt Quick Controls - Contact List}.
|
|
||||||
\endif
|
\endif
|
||||||
|
|
||||||
\sa {Resetting the Code Model}
|
\sa {Resetting the Code Model}
|
||||||
|
Reference in New Issue
Block a user