Merge "Merge remote-tracking branch 'origin/4.15'"

This commit is contained in:
The Qt Project
2021-03-25 10:48:57 +00:00
143 changed files with 986 additions and 1081 deletions

View File

@@ -94,6 +94,8 @@ Projects
* Added `Open Terminal Here` for project nodes (QTCREATORBUG-25107) * Added `Open Terminal Here` for project nodes (QTCREATORBUG-25107)
* Added option for running application as root user (QTCREATORBUG-2831, * Added option for running application as root user (QTCREATORBUG-2831,
QTCREATORBUG-25330) QTCREATORBUG-25330)
* Fixed detection of Designer, Linguist, `qmlscene` and `qmlplugindump` for Qt 6
cross-builds
### qmake ### qmake
@@ -109,6 +111,7 @@ Projects
* Added automatic run of conan install on initial CMake call * Added automatic run of conan install on initial CMake call
(QTCREATORBUG-25362) (QTCREATORBUG-25362)
* Added batch editing for CMake configuration * Added batch editing for CMake configuration
* Added `Re-configure with Initial Parameters` button
* Made it possible to copy CMake variables from configuration * Made it possible to copy CMake variables from configuration
(QTCREATORBUG-24781) (QTCREATORBUG-24781)
* Removed utility targets from CMake target locator filters (QTCREATORBUG-24718) * Removed utility targets from CMake target locator filters (QTCREATORBUG-24718)
@@ -192,6 +195,7 @@ Platforms
### iOS ### iOS
* Added support for CMake projects with Qt 6 (QTCREATORBUG-23574) * Added support for CMake projects with Qt 6 (QTCREATORBUG-23574)
* Fixed launch of applications on iOS 14 (QTCREATORBUG-24672)
* Fixed `Attach to Running Application` for long executable paths * Fixed `Attach to Running Application` for long executable paths
(QTCREATORBUG-25286) (QTCREATORBUG-25286)
@@ -203,6 +207,7 @@ Platforms
### MCU ### MCU
* Added error reporting when creating MCU kits fails (QTCREATORBUG-25258) * Added error reporting when creating MCU kits fails (QTCREATORBUG-25258)
* Improved detection of Ultralight library (QTCREATORBUG-25469)
* Fixed that examples were missing from `Welcome` screen (QTCREATORBUG-25320) * Fixed that examples were missing from `Welcome` screen (QTCREATORBUG-25320)
### WASM ### WASM
@@ -210,7 +215,59 @@ Platforms
* Improved handling of Emscripten detection and setup (QTCREATORBUG-23126, * Improved handling of Emscripten detection and setup (QTCREATORBUG-23126,
QTCREATORBUG-23160, QTCREATORBUG-23561, QTCREATORBUG-23741, QTCREATORBUG-23160, QTCREATORBUG-23561, QTCREATORBUG-23741,
QTCREATORBUG-24814, QTCREATORBUG-24822) QTCREATORBUG-24814, QTCREATORBUG-24822)
* Added support for Qt 6 applications with CMake (QTCREATORBUG-25519)
* Fixed ABI detection for Qt 5.15 (QTCREATORBUG-24891) * Fixed ABI detection for Qt 5.15 (QTCREATORBUG-24891)
Credits for these changes go to: Credits for these changes go to:
-------------------------------- --------------------------------
Aleksei German
Alessandro Portale
Alexandru Croitor
Alexis Jeandet
Andre Hartmann
André Pönitz
Bernhard Beschow
Björn Schäpers
BogDan Vatra
Christiaan Janssen
Christian Kandeler
Christian Stenger
Cristian Adam
David Schulz
Dawid Śliwa
Denis Shienkov
Dmitriy Purgin
Eike Ziller
Erik Verbruggen
Fabio Falsini
Fawzi Mohamed
Friedemann Kleint
Henning Gruendl
Jacopo Martellini
Jaroslaw Kobus
Johanna Vanhatapio
Kai Köhne
Kevin Funk
Knud Dollereder
Leander Schulten
Leena Miettinen
Mahmoud Badri
Marco Bubke
Mattias Johansson
Maximilian Goldstein
Michael Weghorn
Michael Winkelmann
Miikka Heikkinen
Mitch Curtis
Nikolai Kosjar
Orgad Shaneh
Oswald Buddenhagen
Raphaël Cotty
Sergey Levin
Thomas Hartmann
Tim Jenssen
Timon Riedelbauch
Tom Praschan
Tuomo Pelkonen
Ulf Hermann
Vikas Pachdha

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -477,46 +477,46 @@
\row \row
\li M220 \li M220
\li Error \li Error
\li This type (type name) is not supported as a root element of a Qt \li This type (type name) is not supported as a root element of a
Quick UI form. UI file (.ui.qml).
\li \li
\row \row
\li M221 \li M221
\li Error \li Error
\li This type (type name) is not supported in a Qt Quick UI form. \li This type (type name) is not supported in a UI file (.ui.qml).
\li \li
\row \row
\li M222 \li M222
\li Error \li Error
\li Functions are not supported in a Qt Quick UI form. \li Functions are not supported in a UI file (.ui.qml).
\li For a list of supported JavaScript functions, see \li For a list of supported JavaScript functions, see
\l{Supported Methods}. \l{Supported Methods}.
\row \row
\li M223 \li M223
\li Error \li Error
\li Java Script blocks are not supported in a Qt Quick UI form. \li Java Script blocks are not supported in a UI file (.ui.qml).
\li \li
\row \row
\li M224 \li M224
\li Error \li Error
\li Behavior type is not supported in a Qt Quick UI form. \li Behavior type is not supported in a UI file (.ui.qml).
\li \li
\row \row
\li M225 \li M225
\li Error \li Error
\li States are only supported in the root item in a Qt Quick UI form. \li States are only supported in the root item in a UI file (.ui.qml).
\li \li
\row \row
\li M226 \li M226
\li Error \li Error
\li Referencing the parent of the root item is not supported in a Qt \li Referencing the parent of the root item is not supported in a
Quick UI form. UI file (.ui.qml).
\li \li
\row \row

View File

@@ -302,8 +302,9 @@
\li QML files, which specify items in Qt Quick projects. \li QML files, which specify items in Qt Quick projects.
\uicontrol {QML File (Qt Quick 2)} creates a QML file that imports \uicontrol {QML File (Qt Quick 2)} creates a QML file that imports
Qt Quick 2.0 and \uicontrol {Qt Quick UI File} creates an UI form Qt Quick 2.0, and \uicontrol {Qt Quick UI File} creates a
(\e .ui.qml) and the corresponding QML file. \l{UI Files}{UI file} (\e .ui.qml) and the corresponding
implementation file (\e .qml).
\li JavaScript files that you can use to write the application logic in \li JavaScript files that you can use to write the application logic in
Qt Quick projects Qt Quick projects

View File

@@ -117,11 +117,11 @@
\li \l{Creating Scalable Buttons and Borders} \li \l{Creating Scalable Buttons and Borders}
\endlist \endlist
\li \l{Specifying Component Properties} \li \l{Specifying Component Properties}
\li \l{Positioning Items} \li \l{Positioning Components}
\li \l{Using Custom Fonts} \li \l{Using Custom Fonts}
\li \l{Annotating Designs} \li \l{Annotating Designs}
\li \l{Loading Placeholder Data} \li \l{Loading Placeholder Data}
\li \l{Qt Quick UI Forms} \li \l{UI Files}
\endlist \endlist
\li \l {Adding Dynamics} \li \l {Adding Dynamics}
\list \list
@@ -146,12 +146,11 @@
\li \l{Exporting from Maya}{Maya} \li \l{Exporting from Maya}{Maya}
\endlist \endlist
\li \l{Importing 3D Assets} \li \l{Importing 3D Assets}
\li \l{Editing 3D Assets in Design Mode}
\li \l{Adding 3D Views} \li \l{Adding 3D Views}
\li \l{Using 3D Components} \li \l{Using 3D Components}
\list \list
\li \l{Setting Group Properties} \li \l{Setting Group Properties}
\li \l{Adding Models} \li \l{Adding 3D Models}
\li \l{Using Materials and Shaders} \li \l{Using Materials and Shaders}
\li \l{Attaching Textures to Materials} \li \l{Attaching Textures to Materials}
\li \l{Using 3D Materials} \li \l{Using 3D Materials}
@@ -166,7 +165,7 @@
\li \l {Browsing ISO 7000 Icons} \li \l {Browsing ISO 7000 Icons}
\li \l {Using QML Modules with Plugins} \li \l {Using QML Modules with Plugins}
\li \l {Converting UI Projects to Applications} \li \l {Converting UI Projects to Applications}
\li \l {Exporting QML} \li \l {Exporting Components}
\endlist \endlist
\li \l{Developing Widget Based Applications} \li \l{Developing Widget Based Applications}
\list \list

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -101,9 +101,9 @@
convert them to Qt Quick Application projects that contain .pro, convert them to Qt Quick Application projects that contain .pro,
.cpp, and .qrc files. .cpp, and .qrc files.
\li \l {Exporting QML} \li \l {Exporting Components}
\l{Qt Quick UI Forms}{UI forms} (ui.qml files) can be exported to \l{UI Files}{UI files} (.ui.qml) can be exported to
JSON metadata format and PNG assets. JSON metadata format and PNG assets.
\endlist \endlist

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -34,8 +34,8 @@
You can add icons from an ISO 7000 icon library that is installed with \QC You can add icons from an ISO 7000 icon library that is installed with \QC
to Qt Quick applications (commercial only). You can use the to Qt Quick applications (commercial only). You can use the
\uicontrol {ISO Icon Browser} to add a \l {Picture} type and select the \uicontrol {ISO Icon Browser} to add a \l {Picture} component and select the
icon to use for the type. You can change the default color of the icon. icon to use for the component. You can change the default color of the icon.
\image qtcreator-iso-icon-browser.png \image qtcreator-iso-icon-browser.png
@@ -45,16 +45,16 @@
\li Create a new Qt Quick Application or open an application in \QC. \li Create a new Qt Quick Application or open an application in \QC.
\li Open the Qt Quick UI form in the \uicontrol Design mode. \li Open the \l{UI Files}{UI file} (.ui.qml) in \l {Form Editor}.
\li In the \uicontrol Library, select \uicontrol {QML Imports} > \li Select \l Library > \uicontrol Components > \inlineimage plus.png
\uicontrol {Add Import} > \uicontrol {QtQuick.Extras} to import the > \uicontrol {QtQuick.Extras} to import the \l {Qt Quick Extras}
\l {Qt Quick Extras} module. module.
\li Drag and drop a \uicontrol Picture element from the library to the \li Drag and drop a \uicontrol Picture component from \uicontrol Library
canvas. to \l {Form Editor}.
\li Right-click the picture element and select \uicontrol {Choose Icon} \li Right-click the picture component and select \uicontrol {Choose Icon}
to open the \uicontrol {ISO Icon Browser}. to open the \uicontrol {ISO Icon Browser}.
\li To find icons, select a criterion for filtering icons and enter a \li To find icons, select a criterion for filtering icons and enter a

View File

@@ -48,9 +48,9 @@
\section1 Naming Conventions \section1 Naming Conventions
Establish naming conventions to keep the items in your UI organized. Establish naming conventions to keep the components in your UI organized.
Name your items accurately and give them suitable QML IDs. You should Name your components accurately and give them suitable IDs. You should
manually specify the names of the items you export from design tools to manually specify the names of the components you export from design tools to
create reliable and self-explanatory names that follow the naming create reliable and self-explanatory names that follow the naming
conventions you have established. conventions you have established.
@@ -82,20 +82,21 @@
components that can be conveniently recombined to suit the needs of components that can be conveniently recombined to suit the needs of
your UI. your UI.
\li Use as few components as necessary. To minimize the number of \li Use as few components as necessary. To minimize the number of
components, use alias properties and states to create the components, use \l{Adding Property Aliases}{alias properties} and
differences in your instances. We recommend reusing components \l{Adding States}{states} to create the differences in your
component instances. We recommend reusing components
instead of duplicating them, so the components do not need to be instead of duplicating them, so the components do not need to be
processed as completely new types. This reduces loading and processed as completely new component types. This reduces loading
compilation time as well as the size of the binary. and compilation time as well as the size of the binary.
\li Any content that is data-driven should be \li Any content that is data-driven should be
\l {Using Qt Quick UI Forms}{exported as a public property} of the \l {Using UI Files}{exported as a public property} of the
relevant component. For example, a speedometer should have an \c int relevant component. For example, a speedometer should have an \c int
or \c real property for speed to which the UI is bound. or \c real property for speed to which the UI is bound.
\li Separate UI from the application logic. Designers should work with \li Separate UI from the application logic. Designers should work with
the UI forms (.ui.qml files), while developers should work on the the \l{UI Files}{UI files} (.ui.qml), while developers should work
corresponding QML files (.qml) to define their programmatic on the corresponding implementation files (.qml) to define their
behaviors or JavaScript. This enables iteration from both the design programmatic behaviors or JavaScript. This enables iteration from
and development side of the process without the the risk of both the design and development side of the process without the the
overwriting each other's work. risk of overwriting each other's work.
\endlist \endlist
*/ */

View File

@@ -273,7 +273,7 @@
and set the button text for each button instance, for example. and set the button text for each button instance, for example.
For more information about positioning buttons on screens, see For more information about positioning buttons on screens, see
\l{Positioning Items}. \l{Positioning Components}.
\image qmldesigner-borderimage.png "Button preview as part of a screen" \image qmldesigner-borderimage.png "Button preview as part of a screen"
*/ */

View File

@@ -83,7 +83,7 @@
\li \l{Adding Signal Handlers} \li \l{Adding Signal Handlers}
\row \row
\li Go to Implementation \li Go to Implementation
\li \l{Using Qt Quick UI Forms} \li \l{Using UI Files}
\row \row
\li Go into Component \li Go into Component
\li \l{Moving Within Components} \li \l{Moving Within Components}

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -32,46 +32,44 @@
\nextpage creator-using-qt-designer.html \nextpage creator-using-qt-designer.html
\endif \endif
\title Exporting QML \title Exporting Components
\l{Qt Quick UI Forms}{UI forms} (ui.qml files) can be exported to \l{glossary-component}{Components} contained in \l{UI Files}
JSON metadata format and PNG assets. {UI files} (.ui.qml) can be exported to JSON metadata format and PNG assets.
To export the \l{Qt Quick UI Forms}{UI forms} (ui.qml files) from the To export the UI files from the current project, select \uicontrol Build >
current project, select \uicontrol Build > \uicontrol {Export QML}. \uicontrol {Export Components}.
The primary use of exported metadata and assets is to generate native file The primary use of exported metadata and assets is to generate native file
formats in content creation tools, such as Adobe Photoshop, using \QB. \QBPS formats in content creation tools, such as Adobe Photoshop, using \QB. \QBPS
can generate PSD files by importing the metadata and assets. can generate PSD files by importing the metadata and assets.
QML is exported as follows: Components are exported as follows:
\list \list
\li QML types inherited from \l [QML]{Item}{Item} are exported, other \li Components (QML types) inherited from \l [QML]{Item}{Item} are
types are ignored. exported, other components are ignored.
\li \l [QML]{Text}{Text} components are exported as metadata only \li \l [QML]{Text}{Text} components are exported as metadata only
and no assets are generated. and no assets are generated.
\li \l [QML]{Rectangle}{Rectangle} and \l [QML]{Image}{Image} types \li \l [QML]{Rectangle}{Rectangle} and \l [QML]{Image}{Image}
generate assets as PNG files. components generate assets as PNG files.
\endlist \endlist
\section1 Configuring QML Export \section1 Configuring QML Export
You can configure the export in the \uicontrol {Export QML} dialog, which You can configure the export in the \uicontrol {Export Components} dialog,
lists the \l{Qt Quick UI Forms}{UI forms} (ui.qml files) of the current which lists the UI files (.ui.qml) of the current project.
project.
\image qtquick-qml-export-dialog.png "QML Export Dialog" \image qtquick-qml-export-dialog.png "Export Components dialog"
\list 1 \list 1
\li In the \uicontrol {Export path} field, specify the path where \li In the \uicontrol {Export path} field, specify the path where
the metadata file and assets are exported. the metadata file and assets are exported.
\li Deselect the \uicontrol {Export assets} check box to disable \li Deselect the \uicontrol {Export assets} check box to disable
exporting assets and only generate the metadata file. exporting assets and only generate the metadata file.
\li Select the \uicontrol {Export components separately} check box to generate separate \li Select the \uicontrol {Export components separately} check box to
metadata files for each component. generate separate metadata files for each component.
\li In the file list, select the \l{Qt Quick UI Forms}{UI forms} \li In the file list, select the .ui.qml files to be exported.
to be exported.
\li Select \uicontrol {Export} export to start the export process. \li Select \uicontrol {Export} export to start the export process.
\endlist \endlist
*/ */

View File

@@ -119,7 +119,7 @@
\image qmldesigner-form-editor-move-cursor.png "Move cursor in Form Editor view" \image qmldesigner-form-editor-move-cursor.png "Move cursor in Form Editor view"
For more information about alternative ways of positioning components in For more information about alternative ways of positioning components in
UIs, see \l{Positioning Items}. UIs, see \l{Positioning Components}.
\section1 Resizing 2D Components \section1 Resizing 2D Components
@@ -193,7 +193,7 @@
\image qmldesigner-snap-margins.png "Snapping lines on canvas" \image qmldesigner-snap-margins.png "Snapping lines on canvas"
For alternative ways of aligning and distributing components by using the For alternative ways of aligning and distributing components by using the
\l Properties view, see \l{Aligning and Distributing Items}. \l Properties view, see \l{Aligning and Distributing Components}.
\section1 Hiding Component Boundaries \section1 Hiding Component Boundaries

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -35,20 +35,20 @@
\title Loading Placeholder Data \title Loading Placeholder Data
The Design mode supports views, models, and delegates, so that when you add \QC supports views, models, and delegates, so that when you add
a Grid View, List View, or Path View item, the ListModel and the delegate a Grid View, List View, or Path View component, the ListModel and
item are added automatically. the delegate component are added automatically.
However, the missing context of the application presents a challenge. However, the missing context of the application presents a challenge.
Specific models defined in C++ are the most obvious case. Often, Specific models defined in C++ are the most obvious case. Often,
the context is missing simple properties, which are either defined in C++, the context is missing simple properties, which are either defined in C++,
or in other QML files. A typical example is an item that uses the or in other component files. A typical example is a component that uses the
properties of its parent, such as \c parent.width. properties of its parent, such as \c parent.width.
\section1 Using Dummy Models \section1 Using Dummy Models
If you open a file in the Design mode that references a C++ model, you see If you open a file in \l {Form Editor} that references a C++ model, you see
nothing on the canvas. If the data in the model is fetched from the nothing in it. If the data in the model is fetched from the
internet, you have no control over it. To get reliable data, \e {dummy data} internet, you have no control over it. To get reliable data, \e {dummy data}
was introduced. was introduced.
@@ -66,7 +66,7 @@
Create a directory named \e dummydata in the root directory of the project, Create a directory named \e dummydata in the root directory of the project,
so that it is not deployed to the device. In the \c dummydata directory, so that it is not deployed to the device. In the \c dummydata directory,
create a QML file that has the same name as the value of \c model: create a file (.qml) that has the same name as the value of \c model:
\code \code
qml/exampleapp/example.qml qml/exampleapp/example.qml
@@ -93,7 +93,7 @@
\section1 Creating Dummy Context \section1 Creating Dummy Context
The following example presents a common pattern in QML: The following example presents a common pattern:
\qml \qml
Item { Item {
@@ -102,11 +102,11 @@
} }
\endqml \endqml
This works nicely for applications but the Design mode displays a zero-sized This works nicely for applications but \uicontrol {Form Editor} displays a
item. A parent for the opened file does not exist, because the context is zero-sized component. A parent for the opened file does not exist, because
missing. To get around the missing context, the idea of a \e {dummy the context is missing. To get around the missing context, the idea of a
context} is introduced. If you place a file with the same name as the \e {dummy context} is introduced. If you place a file with the same name as
application (here, example.qml) in the \c {dummydata/context} directory, the application (here, example.qml) in the \c {dummydata/context} directory,
you can fake a parent context: you can fake a parent context:
\qml \qml

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -28,49 +28,48 @@
\previouspage qtquick-properties.html \previouspage qtquick-properties.html
\nextpage qtquick-fonts.html \nextpage qtquick-fonts.html
\title Positioning Items \title Positioning Components
The position of an item in a UI can be either absolute or relative to The position of a \l{glossary-component}{component} in a UI can be either
other items. The visual types exist at a particular location in the screen absolute or relative to other components. The visual components exist at a
coordinate system at any instant in time. The x and y coordinates of a particular location in the screen coordinate system at any instant in time.
visual item are relative to those of its visual parent, with the top-left The x and y coordinates of a visual component are relative to those of its
corner having the coordinate (0, 0). visual parent, with the top-left corner having the coordinate (0, 0).
If you are designing a static UI, If you are designing a static UI,
\l{Important Concepts In Qt Quick - Positioning#manual-positioning} \l{Important Concepts In Qt Quick - Positioning#manual-positioning}
{manual positioning} provides the most efficient form of positioning {manual positioning} provides the most efficient form of positioning
items. For a dynamic UI, you can employ the following positioning components. For a dynamic UI, you can employ the following positioning
methods: methods:
\list \list
\li \l{Setting Bindings} \li \l{Setting Bindings}
\li \l{Setting Anchors and Margins} \li \l{Setting Anchors and Margins}
\li \l{Aligning and Distributing Items} \li \l{Aligning and Distributing Components}
\li \l{Using Positioners} \li \l{Using Positioners}
\li \l{Using Layouts} \li \l{Using Layouts}
\li \l{Organizing Items} \li \l{Organizing Components}
\endlist \endlist
\section2 Setting Bindings \section2 Setting Bindings
\l{Positioning with Bindings} {Property binding} is a declarative way of \l{Positioning with Bindings}{Property binding} is a declarative way of
specifying the value of a property. Binding allows a property value to be specifying the value of a property. Binding allows a property value to be
expressed as a JavaScript expression that defines the value relative to expressed as a JavaScript expression that defines the value relative to
other property values or data accessible in the application. The property other property values or data accessible in the application. The property
value is automatically kept up to date if the other properties or data value is automatically kept up to date if the other properties or data
values change. values change.
Property bindings are created implicitly in QML whenever a property is Property bindings are created implicitly whenever a property is assigned a
assigned a JavaScript expression. To set JavaScript expressions as values JavaScript expression. To set JavaScript expressions as values of properties
of properties in the \uicontrol Properties view, select the in the \l Properties view, select the \inlineimage icons/action-icon.png
\inlineimage icons/action-icon.png
(\uicontrol Actions) menu next to a property, and then select (\uicontrol Actions) menu next to a property, and then select
\uicontrol {Set Binding}. \uicontrol {Set Binding}.
\image qmldesigner-set-expression.png "Type properties context menu" \image qmldesigner-set-expression.png "Actions menu"
In \uicontrol {Binding Editor}, select an item and a property from In \uicontrol {Binding Editor}, select a component and a property from
lists of available items and their properties. lists of available components and their properties.
\image qmldesigner-binding-editor.png "Binding Editor" \image qmldesigner-binding-editor.png "Binding Editor"
@@ -84,58 +83,58 @@
\inlineimage icons/action-icon-binding \inlineimage icons/action-icon-binding
. To remove bindings, select \uicontrol Actions > \uicontrol Reset. . To remove bindings, select \uicontrol Actions > \uicontrol Reset.
You can set bindings also in the \uicontrol Connections view. For more You can set bindings also in the \l Connections view. For more
information, see \l {Adding Bindings Between Properties}. information, see \l {Adding Bindings Between Properties}.
For more information on the JavaScript environment provided by QML, see For more information on the JavaScript environment provided, see
\l{Integrating QML and JavaScript}. \l{Integrating QML and JavaScript}.
Bindings are a black box for \QC and using them might have a Bindings are a black box for \QC and using them might have a
negative impact on performance, so consider setting anchors and margins for negative impact on performance, so consider setting anchors and margins for
items, instead. For example, instead of setting \c {parent.width} for an components, instead. For example, instead of setting \c {parent.width} for a
item, you could anchor the item to its sibling items on the left and the component, you could anchor the component to its sibling components on the
right. left and the right.
\section2 Setting Anchors and Margins \section2 Setting Anchors and Margins
In an \l{Important Concepts In Qt Quick - Positioning#anchors} In an \l{Important Concepts In Qt Quick - Positioning#anchors}
{anchor-based} layout, each QML type can be thought of as having a set of {anchor-based} layout, each component can be thought of as having a set of
invisible \e anchor lines: top, bottom, left, right, fill, horizontal invisible \e anchor lines: top, bottom, left, right, fill, horizontal
center, vertical center, and baseline. center, vertical center, and baseline.
In the \uicontrol Layout tab you can set anchors and margins for items. To In \l Properties > \uicontrol Layout, you can set anchors and margins for
set the anchors of an item, click the anchor buttons. You can combine the components. To set the anchors of a component, click the anchor buttons.
top/bottom, left/right, and horizontal/vertical anchors to anchor items in You can combine the top/bottom, left/right, and horizontal/vertical anchors
the corners of the parent item or center them horizontally or vertically to anchor components in the corners of the parent component or center them
within the parent item. horizontally or vertically within the parent component.
\image qmldesigner-anchor-buttons.png "Anchor buttons" \image qmldesigner-anchor-buttons.png "Anchor buttons"
For convenience, you can click the \inlineimage icons/anchor-fill.png For convenience, you can click the \inlineimage icons/anchor-fill.png
(\uicontrol {Fill to Parent}) toolbar button to apply fill anchors to an (\uicontrol {Fill to Parent}) toolbar button to apply fill anchors to a
item and the \inlineimage qtcreator-anchors-reset-icon.png component and the \inlineimage qtcreator-anchors-reset-icon.png
(\uicontrol {Reset Anchors}) button to reset the anchors to their saved (\uicontrol {Reset Anchors}) button to reset the anchors to their saved
state. state.
You can specify the baseline anchor in \uicontrol {Text Editor}. You can specify the baseline anchor in \uicontrol {Text Editor}.
For performance reasons, you can only anchor an item to its siblings For performance reasons, you can only anchor a component to its siblings
and direct parent. By default, an item is anchored to its parent when and direct parent. By default, a component is anchored to its parent when
you use the anchor buttons. Select a sibling of the item in the you use the anchor buttons. Select a sibling of the component in the
\uicontrol Target field to anchor to it, instead. \uicontrol Target field to anchor to it instead.
Arbitrary anchoring is not supported. For example, you cannot specify: Arbitrary anchoring is not supported. For example, you cannot specify:
\c {anchor.left: parent.right}. You have to specify: \c {anchor.left: parent.right}. You have to specify:
\c {anchor.left: parent.left}. When you use the anchor buttons, anchors to \c {anchor.left: parent.left}. When you use the anchor buttons, anchors to
the parent item are always specified to the same side. However, anchors to the parent component are always specified to the same side. However, anchors
sibling items are specified to the opposite side: to sibling components are specified to the opposite side:
\c {anchor.left: sibling.right}. This allows you to keep sibling items \c {anchor.left: sibling.right}. This allows you to keep sibling components
together. together.
In the following image, \uicontrol{Rectangle 2} is anchored to In the following image, \uicontrol{Rectangle 2} is anchored to
\uicontrol {Rectangle 1} on its left and to the bottom of its parent. \uicontrol {Rectangle 1} on its left and to the bottom of its parent.
\image qmldesigner-anchors.png "Anchoring sibling items" \image qmldesigner-anchors.png "Anchoring sibling components"
The anchors for \uicontrol{Rectangle 2} are specified as follows in code: The anchors for \uicontrol{Rectangle 2} are specified as follows in code:
@@ -150,109 +149,110 @@
} }
\endqml \endqml
Margins specify the amount of empty space to leave to the outside of an Margins specify the amount of empty space to leave to the outside of a
item. Margins only have meaning for anchors. They do not take any effect component. Margins only have meaning for anchors. They do not take any
when using layouts or absolute positioning. effect when using layouts or absolute positioning.
\section2 Aligning and Distributing Items \section2 Aligning and Distributing Components
When you're working with a group of items, you can select them to align When you're working with a group of components, you can select them to align
and distribute them evenly. As the positions of the items are fixed, you and distribute them evenly. As the positions of the components are fixed,
cannot apply these functions to anchored items. For scalability, you can you cannot apply these functions to anchored components. For scalability,
anchor the aligned and distributed items when your design is ready. you can anchor the aligned and distributed components when your design is
ready.
\image qmldesigner-alignment.png "Aligning sibling items" \image qmldesigner-alignment.png "Aligning sibling components"
Select the buttons in the \uicontrol Align group to align the top/bottom Select the buttons in the \uicontrol Align group to align the top/bottom
or left/right edges of the items in the group to the one farthest away from or left/right edges of the components in the group to the one farthest away
the center of the group. For example, when left-aligning, the items are from the center of the group. For example, when left-aligning, the
aligned to the leftmost item. You can also align the horizontal/vertical components are aligned to the leftmost component. You can also align the
centers of items, or both, as in the image above. horizontal/vertical centers of components, or both, as in the image above.
In the \uicontrol {Align to} field, select whether to align the items in In the \uicontrol {Align to} field, select whether to align the components
respect to the selection, the root item, or a \e {key object} that you in respect to the selection, the root component, or a \e {key component}
select in the \uicontrol {Key object} field. The key object must be a part that you select in the \uicontrol {Key object} field. The key component must
of the selection. be a part of the selection.
You can distribute either \e objects or the \e spacing between them. If the You can distribute either \e components or the \e spacing between them.
objects or spacing cannot be distributed to equal pixel values without If the components or spacing cannot be distributed to equal pixel values
ending up with half pixels, you receive a notification. You can either allow without ending up with half pixels, you receive a notification. You can
\QDS to distribute objects or spacing using the closest values possible or either allow \QDS to distribute components or spacing using the closest
tweak your design so that the objects and spacing can be distributed values possible or tweak your design so that the components and spacing
perfectly. can be distributed perfectly.
When distributing objects, you can select whether the distance between When distributing components, you can select whether the distance between
them is calculated from their top/bottom or left/right edges or their them is calculated from their top/bottom or left/right edges or their
horizontal/vertical center. horizontal/vertical center.
\image qmldesigner-distribute-objects.png "Distribute objects buttons" \image qmldesigner-distribute-objects.png "Distribute components buttons"
You can distribute spacing either evenly within a target area or at You can distribute spacing either evenly within a target area or at
specified distances, calculated from a starting point. specified distances, calculated from a starting point.
You can select the orientation in which the objects are distributed evenly You can select the orientation in which the components are distributed
within the target area: horizontally along the x axis or vertically along evenly within the target area: horizontally along the x axis or vertically
the y axis. along the y axis.
\image qmldesigner-distribute-spacing-evenly.png "Distribute spacing evenly" \image qmldesigner-distribute-spacing-evenly.png "Distribute spacing evenly"
Alternatively, you can distribute spacing in pixels by selecting one of the Alternatively, you can distribute spacing in pixels by selecting one of the
starting point buttons: left/right or top/bottom edge of the target area, starting point buttons: left/right or top/bottom edge of the target area,
or its horizontal/vertical center. Note that some items might end up outside or its horizontal/vertical center. Note that some components might end up
the target area. outside the target area.
\image qmldesigner-distribute-spacing-pixels.png "Distribute spacing in pixels" \image qmldesigner-distribute-spacing-pixels.png "Distribute spacing in pixels"
You can set the space between objects in pixels. You can You can set the space between components in pixels. You can
disable the distribution of spacing in pixels by clicking disable the distribution of spacing in pixels by clicking
the \inlineimage icons/distribute-origin-none.png the \inlineimage icons/distribute-origin-none.png
button. button.
\section2 Using Positioners \section2 Using Positioners
Positioner items are container items that manage the positions of Positioner components are containers that manage the positions of their
items. For many use cases, the best positioner to use is a simple child components. For many use cases, the best positioner to use is a simple
column, row, flow, or grid. You can use the QML types available in column, row, flow, or grid. You can use the components available in
the \uicontrol {Qt Quick - Positioner} section of \uicontrol Library \l Library > \uicontrol Components > \uicontrol {Default Components} >
to position the children of an item in these formations in the most \uicontrol Positioner to position the children of a component in these
efficient manner possible. formations in the most efficient manner possible.
To position several items in a \uicontrol Column, \uicontrol Row, To position several components in a \uicontrol Column, \uicontrol Row,
\uicontrol Flow, or \uicontrol Grid, select the items in \uicontrol Flow, or \uicontrol Grid, select the components in
\uicontrol {Form Editor}, and then select \uicontrol Position in \l {Form Editor}, and then select \uicontrol Position in
the context menu. the context menu.
\section3 Column Positioner \section3 Column Positioner
A \uicontrol Column positions its child items along a single column. A \uicontrol Column positions its child components along a single column.
It can be used as a convenient way to vertically position a series of It can be used as a convenient way to vertically position a series of
items without using anchors. components without using anchors.
\image qtquick-positioner-column-properties.png "Column properties" \image qtquick-positioner-column-properties.png "Column properties"
For all positioners, you can specify the spacing between the child For all positioners, you can specify the spacing between the child
items that they contain in the \uicontrol Spacing field. components that they contain in the \uicontrol Spacing field.
In addition, you can specify the vertical and horizontal padding between In addition, you can specify the vertical and horizontal padding between
content and the left, right, top, and bottom edges of items as values of content and the left, right, top, and bottom edges of components as values
the fields in the \uicontrol Padding group. of the fields in the \uicontrol Padding group.
\section3 Row and Flow Positioners \section3 Row and Flow Positioners
A \uicontrol Row positions its child items along a single row. It can be A \uicontrol Row positions its child components along a single row. It can
used as a convenient way to horizontally position a series of items without be used as a convenient way to horizontally position a series of components
using anchors. without using anchors.
The \uicontrol Flow type positions its child items like words on a page, The \uicontrol Flow component positions its child components like words on a
wrapping them to create rows or columns of items. page, wrapping them to create rows or columns of components.
\image qtquick-positioner-flow-properties.png "Flow properties" \image qtquick-positioner-flow-properties.png "Flow properties"
For flow and row positioners, you can also set the direction of a flow to For flow and row positioners, you can also set the direction of a flow to
either left-to-right or top-to-bottom in the \uicontrol Flow field. either left-to-right or top-to-bottom in the \uicontrol Flow field.
Items are positioned next to to each other according to the value you set Components are positioned next to to each other according to the value you
in the \uicontrol {Layout direction} field until the width or height of the set in the \uicontrol {Layout direction} field until the width or height of
Flow item is exceeded, then wrapped to the next row or column. the Flow component is exceeded, then wrapped to the next row or column.
You can set the layout direction to either \uicontrol LeftToRight or You can set the layout direction to either \uicontrol LeftToRight or
\uicontrol RightToLeft in the \uicontrol {Layout direction} field. If \uicontrol RightToLeft in the \uicontrol {Layout direction} field. If
@@ -262,31 +262,31 @@
\section3 Grid Positioner \section3 Grid Positioner
A \uicontrol Grid creates a grid of cells that is large enough to hold all A \uicontrol Grid creates a grid of cells that is large enough to hold all
of its child items, and places these items in the cells from left to right of its child components, and places these components in the cells from left
and top to bottom. Each item is positioned at the top-left corner of its to right and top to bottom. Each component is positioned at the top-left
cell with position (0, 0). corner of its cell with position (0, 0).
\QC generates the grid based on the positions of the child items in \QC generates the grid based on the positions of the child components in
\uicontrol {Form Editor}. You can modify the number of rows and columns \l {Form Editor}. You can modify the number of rows and columns in the
in the \uicontrol Rows and \uicontrol Columns fields. \uicontrol Rows and \uicontrol Columns fields.
\image qtquick-positioner-grid-properties.png "Grid properties" \image qtquick-positioner-grid-properties.png "Grid properties"
In addition to the flow and layout direction, you can set the horizontal In addition to the flow and layout direction, you can set the horizontal
and vertical alignment of grid items. By default, grid items are vertically and vertical alignment of grid components. By default, grid components are
aligned to the top. Horizontal alignment follows the value of the vertically aligned to the top. Horizontal alignment follows the value of the
\uicontrol {Layout direction} field. For example, when layout direction is \uicontrol {Layout direction} field. For example, when layout direction is
set to \uicontrol LeftToRight, the items are aligned on the left. set to \uicontrol LeftToRight, the components are aligned on the left.
To mirror the layout, set the layout direction to \uicontrol RightToLeft. To mirror the layout, set the layout direction to \uicontrol RightToLeft.
To also mirror the horizontal alignment of items, select To also mirror the horizontal alignment of components, select
\uicontrol AlignRight in the \uicontrol {Horizontal item alignment} field. \uicontrol AlignRight in the \uicontrol {Horizontal item alignment} field.
\section3 Summary of Positioners \section3 Summary of Positioners
The following table lists the positioners that you can use to arrange items The following table lists the positioners that you can use to arrange
in UIs. They are available in the \uicontrol {Qt Quick - Positioner} section components in UIs. They are available in \l Library > \uicontrol Components
of \uicontrol Library. > \uicontrol {Default Components} > \uicontrol Positioner.
\table \table
\header \header
@@ -296,84 +296,85 @@
\row \row
\li \inlineimage column-positioner-icon-16px.png \li \inlineimage column-positioner-icon-16px.png
\li \l[QtQuick] {Column} \li \l[QtQuick] {Column}
\li Arranges its child items vertically. \li Arranges its child components vertically.
\row \row
\li \inlineimage row-positioner-icon-16px.png \li \inlineimage row-positioner-icon-16px.png
\li \l[QtQuick] {Row} \li \l[QtQuick] {Row}
\li Arranges its child items horizontally. \li Arranges its child components horizontally.
\row \row
\li \inlineimage grid-positioner-icon-16px.png \li \inlineimage grid-positioner-icon-16px.png
\li \l[QtQuick] {Grid} \li \l[QtQuick] {Grid}
\li Arranges its child items so that they are aligned in a grid and \li Arranges its child components so that they are aligned in a grid and
are not overlapping. are not overlapping.
\row \row
\li \inlineimage flow-positioner-icon-16px.png \li \inlineimage flow-positioner-icon-16px.png
\li \l[QtQuick] {Flow} \li \l[QtQuick] {Flow}
\li Arranges its child items side by side, wrapping as necessary. \li Arranges its child components side by side, wrapping as necessary.
\endtable \endtable
\section2 Using Layouts \section2 Using Layouts
\if defined(qtcreator) \if defined(qtcreator)
Since Qt 5.1, you can use QML types in the \l{qtquicklayouts-index.html} Since Qt 5.1, you can use QML types in the \l{qtquicklayouts-index.html}
{Qt Quick Layouts} module to arrange items in UIs. {Qt Quick Layouts} module to arrange components in UIs.
\else \else
You can use the QML types available in the \uicontrol {Qt Quick - Layouts} You can use the components available in \l Library > \uicontrol Components
section of \uicontrol Library to arrange items in UIs. > \uicontrol {Qt Quick Layouts} to arrange components in UIs.
\endif \endif
Unlike positioners, layouts manage both the positions and sizes of their Unlike positioners, layouts manage both the positions and sizes of their
child items, and are therefore well suited for dynamic and resizable UIs. child components, and are therefore well suited for dynamic and resizable
However, this means that you should not specify fixed positions and sizes UIs. However, this means that you should not specify fixed positions and
for the child items in the \uicontrol Geometry group in their properties, sizes for the child components in the \l{2D Geometry}{Geometry} group in
unless their implicit sizes are not satisfactory. \l Properties, unless their implicit sizes are not satisfactory.
You can use anchors or the width and height properties of the layout itself You can use anchors or the width and height properties of the layout itself
to specify its size in respect to its non-layout parent item. However, do to specify its size in respect to its non-layout parent component. However,
not anchor the child items within layouts. do not anchor the child components within layouts.
To arrange several items in a column, row, grid, or To arrange several components in a column, row, grid, or
\uicontrol {Stack Layout}, select the items in \uicontrol {Form Editor}, \uicontrol {Stack Layout}, select the components in \l {Form Editor},
and then select \uicontrol Layout in the context menu. and then select \uicontrol Layout in the context menu.
You can also click the \inlineimage column.png You can also click the \inlineimage column.png
(\uicontrol {Column Layout}), \inlineimage row.png (\uicontrol {Column Layout}), \inlineimage row.png
(\uicontrol {Row Layout}), and \inlineimage grid.png (\uicontrol {Row Layout}), and \inlineimage grid.png
(\uicontrol {Grid Layout}) toolbar buttons to apply (\uicontrol {Grid Layout}) toolbar buttons to apply
layouts to the selected items. layouts to the selected components.
To make an item within a layout as wide as possible while respecting the To make a component within a layout as wide as possible while respecting the
given constraints, select the item in \uicontrol {Form Editor}, and then given constraints, select the component in \uicontrol {Form Editor}, and
select \uicontrol Layout > \uicontrol {Fill Width} in the context menu. To then select \uicontrol Layout > \uicontrol {Fill Width} in the context menu.
make the item as high as possible, select \uicontrol {Fill Height}. To make the component as high as possible, select \uicontrol {Fill Height}.
\section3 Layout Properties \section3 Layout Properties
A \uicontrol {Grid Layout} type provides a way of dynamically arranging A \uicontrol {Grid Layout} component provides a way of dynamically
items in a grid. If the grid layout is resized, all its child items are arranging components in a grid. If the grid layout is resized, all
rearranged. If you want a layout with just one row or one column, use the its child components are rearranged. If you want a layout with just
\uicontrol {Row Layout} or \uicontrol {Column Layout} type. one row or one column, use the \uicontrol {Row Layout} or
\uicontrol {Column Layout} component.
The child items of row and column layout items are automatically positioned The child components of row and column layout components are automatically
either horizontally from left to right as rows or vertically from positioned either horizontally from left to right as rows or vertically from
top to bottom as columns. The number of the child items determines the width top to bottom as columns. The number of the child components determines the
of the row or the height of the column. You can specify the spacing between width of the row or the height of the column. You can specify the spacing
the child items in the \uicontrol Spacing field. between the child components in the \uicontrol Spacing field.
The child items of grid layout items are arranged according to the The child components of grid layout components are arranged according to the
\uicontrol Flow property. When the direction of a flow is set to \uicontrol Flow property. When the direction of a flow is set to
\uicontrol LeftToRight, child items are positioned next to to each \uicontrol LeftToRight, child components are positioned next to to each
other until the the number of \uicontrol Columns is reached. Then, other until the the number of \uicontrol Columns is reached. Then,
the auto-positioning wraps back to the beginning of the next row. the auto-positioning wraps back to the beginning of the next row.
\image qtquick-layout-grid-properties.png "Grid Layout properties" \image qtquick-layout-grid-properties.png "Grid Layout properties"
If you set the direction of the flow to \uicontrol TopToBottom, child If you set the direction of the flow to \uicontrol TopToBottom, child
items are auto-positioned vertically using the value of the \uicontrol Rows components are auto-positioned vertically using the value of the
field to determine the maximum number of rows. \uicontrol Rows field to determine the maximum number of rows.
You can set the layout direction to either \uicontrol LeftToRight or You can set the layout direction to either \uicontrol LeftToRight or
\uicontrol RightToLeft in the \uicontrol {Layout direction} field. \uicontrol RightToLeft in the \uicontrol {Layout direction} field.
When you select \uicontrol RightToLeft, the alignment of the items When you select \uicontrol RightToLeft, the alignment of the components
will be mirrored. will be mirrored.
You can specify the spacing between rows and columns in the You can specify the spacing between rows and columns in the
@@ -383,25 +384,25 @@
\image qtquick-designer-stacked-view.png \image qtquick-designer-stacked-view.png
To add items to a \uicontrol {Stack Layout}, select the To add components to a \uicontrol {Stack Layout}, select the
\inlineimage plus.png \inlineimage plus.png
button next to the type name in \uicontrol {Form Editor}. To move button next to the component name in \l {Form Editor}.
between items, select the \inlineimage prev.png To move between components, select the \inlineimage prev.png
(\uicontrol Previous) and \inlineimage next.png (\uicontrol Previous) and \inlineimage next.png
(\uicontrol Next) buttons. (\uicontrol Next) buttons.
To add a tab bar to a stack layout, select \uicontrol {Stacked Container} > To add a tab bar to a stack layout, select \uicontrol {Stacked Container} >
\uicontrol {Add Tab Bar}. \uicontrol {Add Tab Bar}.
To raise or lower the stacking order of an item, select To raise or lower the stacking order of a component, select
\uicontrol {Stacked Container} > \uicontrol {Increase Index} or \uicontrol {Stacked Container} > \uicontrol {Increase Index} or
\uicontrol {Decrease Index}. \uicontrol {Decrease Index}.
\section3 Summary of Layouts \section3 Summary of Layouts
The following table lists the layout types that you can use to arrange items The following table lists the layout components that you can use to arrange
in UIs. They are available in the \uicontrol {Qt Quick - Layouts} section components in UIs. They are available in \l Library > \uicontrol Components
of \uicontrol Library. > \uicontrol {Qt Quick Layouts}.
\table \table
\header \header
@@ -419,19 +420,20 @@
\row \row
\li \inlineimage grid-layouts-icon-16px.png \li \inlineimage grid-layouts-icon-16px.png
\li \l{GridLayout}{Grid Layout} \li \l{GridLayout}{Grid Layout}
\li Provides a way of dynamically arranging items in a grid. \li Provides a way of dynamically arranging components in a grid.
\row \row
\li \inlineimage stack-layouts-icon-16px.png \li \inlineimage stack-layouts-icon-16px.png
\li \l{StackLayout}{Stack Layout} \li \l{StackLayout}{Stack Layout}
\li Provides a stack of items where only one item is visible at a time. \li Provides a stack of components where only one component is
visible at a time.
\endtable \endtable
\section2 Organizing Items \section2 Organizing Components
The following table lists the UI controls that you can use to The following table lists the UI controls that you can use to
organize items in UIs (since Qt 5.7). They are available in the organize components in UIs (since Qt 5.7). They are available in
\uicontrol {Qt Quick - Controls 2} section of \uicontrol Library. \l Library > \uicontrol Components > \uicontrol {Qt Quick Controls}.
\table \table
\header \header

View File

@@ -158,6 +158,6 @@
\l{Specifying Component Properties}. \l{Specifying Component Properties}.
\li For more information on the properties available for a \li For more information on the properties available for a
component, press \key {F1} or see \l{Component Types} component, press \key {F1} or see \l{Component Types}
and \l{Positioning Items}. and \l{Positioning Components}.
\endlist \endlist
*/ */

View File

@@ -76,7 +76,7 @@
In the \uicontrol Position group, you can set the position of a component on In the \uicontrol Position group, you can set the position of a component on
the x and y axis. The position of a component in the UI can be either the x and y axis. The position of a component in the UI can be either
absolute or relative to other components. For more information, see absolute or relative to other components. For more information, see
\l{Positioning Items}. \l{Positioning Components}.
In the 2D space, the z position of a component determines its position in In the 2D space, the z position of a component determines its position in
relation to its sibling components in the component hierarchy. You can set relation to its sibling components in the component hierarchy. You can set
@@ -85,7 +85,7 @@
In the \uicontrol Size group, you can set the width and height of a In the \uicontrol Size group, you can set the width and height of a
component. You can also use the resize cursor to \l{Resizing 2D Components} component. You can also use the resize cursor to \l{Resizing 2D Components}
{resize 2D components} in \uicontrol {Form Editor} or the scaling gizmo {resize 2D components} in \uicontrol {Form Editor} or the scaling gizmo
to \l{Scaling Items}{scale 3D components} in \uicontrol {3D Editor}. to \l{Scaling Components}{scale 3D components} in \uicontrol {3D Editor}.
The values in the \uicontrol X and \uicontrol Y fields change accordingly. The values in the \uicontrol X and \uicontrol Y fields change accordingly.
The component size and position can also be managed automatically The component size and position can also be managed automatically

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -38,13 +38,12 @@
\endif \endif
\nextpage qtquick-adding-dynamics.html \nextpage qtquick-adding-dynamics.html
\title Qt Quick UI Forms \title UI Files
You can use \QC wizards to create UI forms that have the filename extension You can use \QC wizards to create UI files that have the filename
\e .ui.qml. The UI forms contain a purely declarative subset of the QML extension \e .ui.qml. The UI files can be edited in \l {Form Editor}.
language. It is recommended that you edit the forms in the \uicontrol Design mode. If you use \uicontrol {Text Editor} to add code that is not supported
\QC enforces the use of the supported QML features by displaying error by \uicontrol {Form Editor}, \QC displays error messages.
messages.
The following features are not supported: The following features are not supported:
@@ -52,11 +51,12 @@
\li JavaScript blocks \li JavaScript blocks
\li Other bindings than pure expressions \li Other bindings than pure expressions
\li Signal handlers \li Signal handlers
\li States in other items than the root item \li States in other components than the root component
\li Root items that are not derived from \l QQuickItem or \l [QML]{Item} \li Root components that are not derived from \l QQuickItem or
\l [QML]{Item}
\endlist \endlist
The following types are not supported: The following components are not supported:
\list \list
\li Behavior \li Behavior
@@ -161,11 +161,11 @@
For more information about using the methods, see For more information about using the methods, see
\l{https://doc.qt.io/qt/qml-qtqml-qt.html}{Qt QML Methods}. \l{https://doc.qt.io/qt/qml-qtqml-qt.html}{Qt QML Methods}.
\section1 Using Qt Quick UI Forms \section1 Using UI Files
You can edit the forms in the \uicontrol {Form Editor} and You can edit the UI files in the \l {Form Editor} and
\uicontrol {Text Editor} tabs in the \uicontrol Design mode. Items that are \uicontrol {Text Editor} views. Components that are
supposed to be used in QML code have to be exported as properties: supposed to be used in code have to be exported as properties:
\code \code
Item { Item {
@@ -182,17 +182,16 @@
} }
\endcode \endcode
The property alias exports the button to the QML code that uses the form. The property alias exports the button to the code that uses the form.
You can use the You can use the \inlineimage export_unchecked.png
\inlineimage export_checked.png (\uicontrol Export) button in \l Navigator to export a component
(\uicontrol Export) button in the \uicontrol Navigator to export an item as as a property:
a property:
\image qmldesigner-export-item.png \image qmldesigner-export-item.png
In the QML file that uses the form, you can use the \c button property alias In the UI file where the component is used, you can use the \c button
to implement signal handlers, for example. In the following code snippet, property alias to implement signal handlers, for example. In the
the UI form is called \e MainForm.ui.qml: following code snippet, the UI file is called \e MainForm.ui.qml:
\code \code
MainForm { MainForm {
@@ -203,8 +202,9 @@
You can also assign properties or define behavior or transitions. You can also assign properties or define behavior or transitions.
To move from the \uicontrol Design mode directly to the implementation of a To move from \l {Form Editor} or \l Navigator directly to the
type in the .qml file, right-click the type in the \uicontrol Navigator and implementation of a component in the .qml file, right-click the
select \uicontrol {Go to Implementation} in the context menu. component and select \uicontrol {Go to Implementation} in the
context menu.
*/ */

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Design Studio documentation. ** This file is part of the Qt Design Studio documentation.
@@ -36,27 +36,24 @@
\title Creating UIs \title Creating UIs
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
When you install \QDS, everything you'll need to design UIs When you install \QDS, everything you'll need to design UIs and to preview
using \l{Qt Quick} and to preview them on the desktop or on Android or them on the desktop or embedded Linux devices is automatically installed
embedded Linux devices is automatically installed and configured correctly and configured correctly for you.
for you.
\endif \endif
Qt Quick enables you to build UIs around the behavior of \e components and In \QC, you build UIs around the behavior of \l{glossary-component}
how they connect with one another. You create components using Qt Quick and {components} and how they connect with one another. You can use preset
QML types that are available in the \uicontrol Library view in the Design components available in the \l Library view or combine them to create
mode. You can specify values for the \e properties of a your own components. You can specify values for the \e properties of a
component to change its appearance and behavior. All QML types have a component to change its appearance and behavior. All components have a
set of predefined properties, some of which control things that are set of predefined properties, some of which control things that are
visible to users, while others are used behind the scene. visible to users, while others are used behind the scene.
While it is useful to learn the basics of Qt Quick, you can also rely on When you drag-and-drop the preset components from the \uicontrol Library
\QMLD to write the code for you when you drag-and-drop the ready-made view to the \l {Form Editor} or \l Navigator view and change them to your
components from the \uicontrol Library view to the \uicontrol {Form Editor} liking by modifying their properties in the \l Properties view, the
or \uicontrol Navigator view and change them to your liking by modifying application code is generated for you accordingly. For more information
their properties in the \uicontrol Properties view. about the code, open the developer documentation by pressing \key F1.
You can always check up details in the extensive Qt Quick
documentation by pressing \key F1.
\list \list
@@ -72,35 +69,31 @@
\li \l {Creating Components} \li \l {Creating Components}
You can enhance imported designs by customizing ready-made You can enhance imported designs by customizing preset
components or design custom forms and shapes directly as components or design custom forms and shapes directly as
QML types. You can import visual assets in various formats, components. You can import visual assets in various formats,
such as PNG, JPG, and SVG for use in the components. such as PNG, JPG, and SVG for use in the components.
\li \l {Navigator}
You can manage the items in the current QML file and their
relationships in the \uicontrol Navigator view.
\li \l {Specifying Component Properties} \li \l {Specifying Component Properties}
You can specify values for the properties of a component to change You can specify values for the properties of a component to change
its appearance and behavior. All QML types have a set of predefined its appearance and behavior. All components have a set of predefined
properties. Some properties, such as position, size, and visibility, properties. Some properties, such as position, size, and visibility,
are common to all QML types, whereas others are specific to the QML are common to all components, whereas others are specific to the
type. You can specify properties for your components in the component. You can specify properties for your components in the
\uicontrol Properties view. \l Properties view.
\li \l {Positioning Items} \li \l {Positioning Components}
The position of an item in a UI can be either absolute or relative The position of a component in a UI can be either absolute
to other items. While manual positioning is efficient for a static or relative to other components. While manual positioning
UI, consider the other available method, such as anchors, layouts, is efficient for a static UI, consider the other available
positioners, and property bindings, for dynamic UIs. methods, such as anchors, layouts, positioners, and property
bindings, for dynamic UIs.
\li \l {Using Custom Fonts} \li \l {Using Custom Fonts}
You can load custom fonts to \QMLD and use them in your designs. You can load custom fonts to \QC and use them in your designs.
\li \l {Annotating Designs} \li \l {Annotating Designs}
@@ -123,10 +116,10 @@
\list \list
\endif \endif
\li \l{Qt Quick UI Forms} \li \l{UI Files}
Some of the wizards create Qt Quick projects that contain UI forms Some of the wizards create projects that contain UI files
(.ui.qml files). The forms use a purely declarative subset of the (.ui.qml). You should always edit UI files in \l{Form Editor}
QML language and you can edit them in the Design mode. and \l Properties, to avoid breaking the code.
\endlist \endlist
*/ */

View File

@@ -87,45 +87,45 @@
in the Design mode. For more information about moving views around, in the Design mode. For more information about moving views around,
see \l {Managing Workspaces}. see \l {Managing Workspaces}.
\section2 Learn Qt Quick - Projects and Files \section2 Learn More - Projects and Files
\QDS creates a set of boilerplate files and folders that you need to create \QDS creates a set of boilerplate files and folders that you need to create
a UI using Qt Quick and QML. The files are listed in the \uicontrol Projects a UI. The files are listed in the \uicontrol Projects view. For more
view. For more information, see \l {Viewing Project Files}. information, see \l {Viewing Project Files}.
\image loginui1-project-files.png \image loginui1-project-files.png
\list \list
\li The \e {loginui1.qmlproject} project file defines that all \li The \e {loginui1.qmlproject} project file defines that all
QML, JavaScript, and image files in the project folder belong to component, JavaScript, and image files in the project folder belong
the project. Therefore, you do not need to individually list new to the project. Therefore, you do not need to individually list new
files when you add them to the project. files when you add them to the project.
\li The \e {loginui1.qml} file defines the functionality of \li The \e {loginui1.qml} file defines the functionality of
the UI. For the time being, it does not do anything. the UI. For the time being, it does not do anything.
\li The \e {Screen01.ui.qml} file defines the appearance of the \li The \e {Screen01.ui.qml} file defines the appearance of the
UI. For more information, see \l {Qt Quick UI Forms}. UI. For more information, see \l {UI Files}.
\li The \e {qtquickcontrols2.conf} file specifies the selected \li The \e {qtquickcontrols2.conf} file specifies the selected
\l {Styling Qt Quick Controls}{UI style} and some style-specific \l {Styling Qt Quick Controls}{UI style} and some style-specific
arguments. arguments.
\li The \e imports folder contains a \e {Constants.qml} file that \li The \e imports folder contains a \e {Constants.qml} file that
specifies a font loader for the Arial font and a \e qmldir module specifies a font loader for the Arial font and a \e qmldir module
definition file that declares the Constant QML type. For more definition file that declares the Constant component. For more
information, see \l {Module Definition qmldir Files}. In addition, information, see \l {Module Definition qmldir Files}. In addition,
the \e QtQuick subfolder contains the Studio components and effects the \e QtQuick subfolder contains the Studio components and effects
QML types. You can ignore the subfolder for now, because it is not components. You can ignore the subfolder for now, because it is not
used in this tutorial. used in this tutorial.
\endlist \endlist
QML files define a hierarchy of objects with a highly-readable, structured UI files define a hierarchy of components with a highly-readable, structured
layout. Every QML file consists of two parts: an imports section and an layout. Every UI file consists of two parts: an imports section and an
object declaration section. The QML types and functionality most common to component declaration section. The components and functionality most common to
UIs are provided in the QtQuick import. You can view the QML code of an UIs are provided in the QtQuick import. You can view the code of an
ui.qml file in the \uicontrol {Text Editor} view. .ui.qml file in the \uicontrol {Text Editor} view.
For more information about creating a QML file from scratch, see For more information about creating a component file from scratch, see
\l{First Steps with QML}. \l{First Steps with QML}.
Next, you will edit the values of the properties of the UI elements to Next, you will edit the values of the properties of the UI components to
create the main page of the UI. create the main page of the UI.
\section1 Creating the Main Page \section1 Creating the Main Page

View File

@@ -71,7 +71,7 @@
change for the animation. change for the animation.
For more information about creating and positioning components, see For more information about creating and positioning components, see
\l {Creating Components} and \l {Positioning Items}. \l {Creating Components} and \l {Positioning Components}.
\section1 Animating Progress Bar Elements \section1 Animating Progress Bar Elements

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -252,7 +252,7 @@
\section1 Importing Metadata & Assets \section1 Importing Metadata & Assets
\QBPS can import metadata generated from other tools and generate a Photoshop document. A \QBPS can import metadata generated from other tools and generate a Photoshop document. A
conventional workflow would be to generate metadata and assets by \l {Exporting QML} {exporting} conventional workflow would be to generate metadata and assets by \l {Exporting Components} {exporting}
a QML project from \QDS and use \QBPS to generate a Photoshop document. a QML project from \QDS and use \QBPS to generate a Photoshop document.
Imported text and the assets are organized into Artboards, layers, and groups. Imported text and the assets are organized into Artboards, layers, and groups.

View File

@@ -36,16 +36,16 @@
You will need the following files: You will need the following files:
\list \list
\li Qt Quick file that will specify the API of the UI \li Component file (.qml) that will specify the API of the UI
\li JavaScript file that generates mock data for the UI. \li JavaScript file that generates mock data for the UI.
For more information about using JavaScript, see For more information about using JavaScript, see
\l{Integrating QML and JavaScript}. \l{Integrating QML and JavaScript}.
\li Module definition file (\e qmldir) that declares the QML type \li Module definition file (\e qmldir) that declares the component
you specify in the Qt Quick file. For more information, see (QML type) you specify in the UI file. For more information, see
\l {Module Definition qmldir Files}. \l {Module Definition qmldir Files}.
\endlist \endlist
Here, you will create a QML type based on the QObject class that will Here, you will create a component based on the QObject class that will
be registered as a singleton type. This enables the use of global be registered as a singleton type. This enables the use of global
property values in the UI. property values in the UI.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Design Studio documentation. ** This file is part of the Qt Design Studio documentation.
@@ -67,9 +67,9 @@
to Qt Quick Application projects that contain .pro, .cpp, and .qrc to Qt Quick Application projects that contain .pro, .cpp, and .qrc
files. files.
\li \l {Exporting QML} \li \l {Exporting Components}
You can export UI forms (ui.qml files) to JSON metadata format You can export UI files (.ui.qml) to JSON metadata format
and PNG assets to generate native file formats in content creation and PNG assets to generate native file formats in content creation
tools, such as Adobe Photoshop, using \QB. tools, such as Adobe Photoshop, using \QB.

View File

@@ -103,27 +103,27 @@
\QDS creates the following files and folders: \QDS creates the following files and folders:
\list \list
\li .qmlproject project file defines that all QML, JavaScript, and image \li .qmlproject project file defines that all component, JavaScript, and
files in the project folder belong to the project. Therefore, you do image files in the project folder belong to the project. Therefore,
not need to individually list all the files in the project. you do not need to individually list all the files in the project.
\li .qml file defines a UI item, such as a component, screen, or the \li .qml file defines the functionality and appearance of a component.
whole UI. \li ui.qml file defines a visual component that you can edit in
\li ui.qml file defines a form for the UI. \l{Form Editor}.
\li qtquickcontrols2.conf file specifies the preferred style and some \li qtquickcontrols2.conf file specifies the preferred style and some
style-specific arguments. style-specific arguments.
\li \e fonts folder contains font files that you have added in
\l Library > \uicontrol Assets.
\li \e imports folder contains a \e {Constants.qml} file that specifies \li \e imports folder contains a \e {Constants.qml} file that specifies
a font loader for the Arial font and the screen resolution. The a font loader for the Arial font and the screen resolution. The size
size of the default Screen.ui.qml Rectangle should be set as of the default Screen.ui.qml \l{basic-rectangle}{Rectangle} should
\c {width: Constants.width & height: Constants.height}, so it be set as \c {width: Constants.width & height: Constants.height} so
inherits the global resolution saved here. that it inherits the global resolution saved here.
\li \e qmldir module definition file declares the Constant QML type. \li \e qmldir module definition file declares the Constant component.
For more information, see \l {Module Definition qmldir Files}. For more information, see \l {Module Definition qmldir Files}.
\li In addition, the \e QtQuick subfolder contains the Studio components
and effects QML types.
\endlist \endlist
To use JavaScript and image files in the UI, select \uicontrol Library > To use JavaScript and image files in the UI, select \uicontrol Library >
Assets > Add New Assets. \uicontrol Assets > \inlineimage plus.png.
\section1 Adding Files to Projects \section1 Adding Files to Projects
@@ -133,15 +133,16 @@
\list \list
\li \uicontrol {Qt Quick Files} \li \uicontrol {Qt Quick Files}
\list \list
\li \uicontrol {Flow Item} and \uicontrol {Flow View} generate \li \uicontrol {Flow Item} and \uicontrol {Flow View}
types that you can use to design the application flow. generate components that you can use to design the
\li \uicontrol {Qt Quick File} generates a QML type with one \l{Designing Application Flows}{application flow}.
of the following basic types or \l{Using Positioners} \li \uicontrol {Qt Quick File} generates a component with one
{positioners} as the root item: \l {basic-item}{Item}, of the following default components or \l{Using Positioners}
{positioners} as the root component: \l {basic-item}{Item},
\l {basic-rectangle}{Rectangle}, \l {Images}{Image}, \l {basic-rectangle}{Rectangle}, \l {Images}{Image},
\l {Border Image}, \l Flickable, Row, Column, Flow, or Grid. \l {Border Image}, \l Flickable, Row, Column, Flow, or Grid.
\li \uicontrol {Qt Quick UI File} generates a UI form with one \li \uicontrol {Qt Quick UI File} generates a component file
of the above types as the root item. with one of the above components as the root component.
\li \uicontrol {Qt Quick Views} generates a Grid View or a \li \uicontrol {Qt Quick Views} generates a Grid View or a
List View. For more information, see \l{List and Grid Views}. List View. For more information, see \l{List and Grid Views}.

View File

@@ -88,7 +88,7 @@
\li \l{Importing 3D Assets} \li \l{Importing 3D Assets}
\endlist \endlist
\li \l{Converting UI Projects to Applications} \li \l{Converting UI Projects to Applications}
\li \l{Exporting QML} \li \l{Exporting Components}
\endlist \endlist
\li \l{Creating UIs} \li \l{Creating UIs}
\list \list
@@ -107,10 +107,10 @@
\li \l{Creating Scalable Buttons and Borders} \li \l{Creating Scalable Buttons and Borders}
\endlist \endlist
\li \l{Specifying Component Properties} \li \l{Specifying Component Properties}
\li \l{Positioning Items} \li \l{Positioning Components}
\li \l{Using Custom Fonts} \li \l{Using Custom Fonts}
\li \l{Annotating Designs} \li \l{Annotating Designs}
\li \l{Qt Quick UI Forms} \li \l{UI Files}
\endlist \endlist
\li \l {Adding Dynamics} \li \l {Adding Dynamics}
\list \list
@@ -128,12 +128,11 @@
\endlist \endlist
\li \l{Editing 3D Scenes} \li \l{Editing 3D Scenes}
\list \list
\li \l{Editing 3D Assets in Design Mode}
\li \l{Adding 3D Views} \li \l{Adding 3D Views}
\li \l{Using 3D Components} \li \l{Using 3D Components}
\list \list
\li \l{Setting Group Properties} \li \l{Setting Group Properties}
\li \l{Adding Models} \li \l{Adding 3D Models}
\li \l{Using Materials and Shaders} \li \l{Using Materials and Shaders}
\li \l{Attaching Textures to Materials} \li \l{Attaching Textures to Materials}
\li \l{Using 3D Materials} \li \l{Using 3D Materials}

View File

@@ -59,14 +59,14 @@
\li \l{Using Git} \li \l{Using Git}
\li \l{Importing Designs} \li \l{Importing Designs}
\li \l{Converting UI Projects to Applications} \li \l{Converting UI Projects to Applications}
\li \l{Exporting QML} \li \l{Exporting Components}
\endlist \endlist
\li \b {\l{Creating UIs}} \li \b {\l{Creating UIs}}
\list \list
\li \l{Designing Application Flows} \li \l{Designing Application Flows}
\li \l{Creating Components} \li \l{Creating Components}
\li \l{Specifying Component Properties} \li \l{Specifying Component Properties}
\li \l{Positioning Items} \li \l{Positioning Components}
\li \l{Annotating Designs} \li \l{Annotating Designs}
\endlist \endlist
\li \b {\l{Adding Dynamics}} \li \b {\l{Adding Dynamics}}
@@ -83,7 +83,6 @@
\row \row
\li \b {\l{Editing 3D Scenes}} \li \b {\l{Editing 3D Scenes}}
\list \list
\li \l{Editing 3D Assets in Design Mode}
\li \l{3D Editor} \li \l{3D Editor}
\li \l{Adding 3D Views} \li \l{Adding 3D Views}
\li \l{Using 3D Components} \li \l{Using 3D Components}

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -35,9 +35,20 @@
A camera is always necessary to view the content of a 3D scene. A camera A camera is always necessary to view the content of a 3D scene. A camera
defines how to project the content of a 3D scene into a 2D coordinate space, defines how to project the content of a 3D scene into a 2D coordinate space,
which can then be used on a 2D surface. When a camera is present in the which can then be used on a 2D surface. When a camera is present in the
scene, it can be used to direct what is displayed in a 3D view. scene, it can be used to direct what is displayed in a \l {Adding 3D Views}
{3D view}.
You can use the following 3D QML types to determine camera projection: \image studio-qtquick-3d-components.png "Qt Quick 3D components in Library"
You can add a camera to your scene by dragging-and-dropping one from
\l Library > \uicontrol Components > \uicontrol QtQuick3D > \uicontrol
{Qt Quick 3D} to \l {3D Editor} or to a 3D view in \l Navigator.
If the cameras are not displayed in \uicontrol Library, you should add the
\uicontrol QtQuick3D module to your project, as described in
\l {Adding and Removing Modules}.
You can use the following components in your scenes to determine camera
projection:
\list \list
\li \l{PerspectiveCamera}{Camera Perspective} - is the standard camera \li \l{PerspectiveCamera}{Camera Perspective} - is the standard camera
@@ -60,7 +71,7 @@
You can position the camera in the scene and set the direction it is facing. You can position the camera in the scene and set the direction it is facing.
The default direction of the camera is such that the forward vector is The default direction of the camera is such that the forward vector is
looking up the +z axis, and the up direction vector is up the +y axis. You looking up the +z axis, and the up direction vector is up the +y axis. You
can apply transforms to the camera and its parent types to define can apply transforms to the camera and its parent components to define
exactly where your camera is located and in which direction it is facing. exactly where your camera is located and in which direction it is facing.
The second part of determining the projection of the camera is defining the The second part of determining the projection of the camera is defining the
@@ -69,6 +80,8 @@
You can edit the camera properties in the \uicontrol Properties view. You can edit the camera properties in the \uicontrol Properties view.
\image studio-qtquick-camera-properties "Properties view for Perspective Camera"
\section1 Setting Camera Field of View \section1 Setting Camera Field of View
The camera frustum can be obtained by taking a frustum (that is, a The camera frustum can be obtained by taking a frustum (that is, a

View File

@@ -30,24 +30,25 @@
\title Using 3D Components \title Using 3D Components
To add 3D components to the scene, drag and drop a them from To use 3D components, you need to first add the required modules to your
\uicontrol Library > \uicontrol {QML Types} > \uicontrol {Qt Quick 3D} to project in \l Library. For more information, see
the scene or to a 3D view in \uicontrol Navigator. \l{Adding and Removing Modules}. You can then add 3D components to your scene
by dragging-and-dropping them from \uicontrol Library > \uicontrol Components >
\uicontrol QtQuick3D group to \l {3D Editor} or to a 3D view in \l Navigator.
\note Using 3D components will affect the performance of your UI. You should \note Using 3D components will affect the performance of your UI. You should
not use 3D components if the same results can be achieved using 2D not use 3D components if the same results can be achieved using 2D
components. components.
To edit 3D components, select the component in \uicontrol {3D Editor} or in To edit 3D components, select the component in \uicontrol {3D Editor} or in
\uicontrol Navigator and set its properties in the \uicontrol Properties \uicontrol Navigator and set its properties in the \l Properties view.
view.
\list \list
\li \l {Setting Group Properties} \li \l {Setting Group Properties}
You can set the opacity, visibility, and transform properties You can set the opacity, visibility, and transform properties
of all 3D components. of all 3D components.
\li \l {Adding Models} \li \l {Adding 3D Models}
You can use the model component to load static mesh data from You can use the model component to load static mesh data from
storage or one of the built-in primitive types: cube, cone, storage or one of the built-in primitive types: cube, cone,
@@ -55,7 +56,7 @@
meshes and sub-meshes. meshes and sub-meshes.
\li \l {Using Materials and Shaders} \li \l {Using Materials and Shaders}
You can use materials and shaders to define how object surfaces You can use materials and shaders to define how component surfaces
are rendered in a scene and during live preview. are rendered in a scene and during live preview.
\li \l {Attaching Textures to Materials} \li \l {Attaching Textures to Materials}
@@ -65,7 +66,6 @@
\li \l {Using 3D Materials} \li \l {Using 3D Materials}
You can apply a set of predefined 3D materials on your models. You can apply a set of predefined 3D materials on your models.
\li \l {Applying 3D Effects} \li \l {Applying 3D Effects}
You can use 3D effect components to generate post-processing You can use 3D effect components to generate post-processing
@@ -85,12 +85,12 @@
scene and set their properties. scene and set their properties.
\li \l {Using Scene Camera} \li \l {Using Scene Camera}
To project a 3D scene to a 2D viewport, such as To project a 3D scene to a 2D viewport, such as \l {Form Editor},
\uicontrol {Form Editor}, it is necessary to view the scene from a it is necessary to view the scene from a camera. You can select the
camera. You can select the camera type and set its properties. camera type and set its properties.
\li \l {Setting Scene Environment} \li \l {Setting Scene Environment}
You can use the SceneEnvironment type to specify how the scene is You can use the SceneEnvironment component to specify how the scene
rendered globally. is rendered globally.
\endlist \endlist
*/ */

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -39,23 +39,20 @@
materials. Each effect or material must have a fragment shader that materials. Each effect or material must have a fragment shader that
implements all the functions needed to calculate the shaded color. The implements all the functions needed to calculate the shaded color. The
material system also offers ready-made functions to help you implement material system also offers ready-made functions to help you implement
the material. the material. If the 3D effects and materials are not displayed in
\l Library, you should add the \uicontrol QtQuick3D.Effects and
\uicontrol QtQuick3D.Materials modules to your project, as described in
\l {Adding and Removing Modules}.
The material system supports dielectric, metallic, and transparent The material system supports dielectric, metallic, and transparent
materials, point lights, area lights, ambient occlusion, shadowing, materials, point lights, area lights, ambient occlusion, shadowing,
two-sided polygons, index-of-refraction, and fragment cutoff (masking). two-sided polygons, index-of-refraction, and fragment cutoff (masking).
For more information, see \l {Qt Quick 3D Custom Material Reference}. For more information, see \l {Qt Quick 3D Custom Material Reference}.
You can use the QML types in the \uicontrol {Qt Quick 3D Custom Shader Utils} You can use the components in \uicontrol Library > \uicontrol Components >
tab of \uicontrol Library to create custom effects and materials. To make \uicontrol QtQuick3D > \uicontrol {Qt Quick 3D Custom Shader Utils} to
the \uicontrol Effect and \uicontrol {Custom Material} types appear in the create custom effects and materials. For more information about the shader
tab, you must select \uicontrol {Add Import} in the \uicontrol {QML Imports} utilities and commands and their properties, see \l {Using Custom Shaders}.
tab, and then select \uicontrol QtQuick3D.Effects and
\uicontrol QtQuick3D.Materials to import the QML types in those modules to
your project.
For more information about the shader utilities and commands and their
properties, see \l {Using Custom Shaders}.
\image studio-qtquick-3d-shader-utilities.png "Qt Quick 3D Custom Shader Utils tab in Library" \image studio-qtquick-3d-shader-utilities.png "Qt Quick 3D Custom Shader Utils tab in Library"

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -32,8 +32,15 @@
\title Using Custom Shaders \title Using Custom Shaders
You can use the Qt Quick 3D shader utilities and commands to create your own You can use the 3D shader utilities and commands available in \l Library
effects and materials. > \uicontrol Components > \uicontrol QtQuick3D > \uicontrol
{Custom Shader Utils} to create your own effects and materials.
\image studio-qtquick-3d-shader-utilities.png
If the custom shader utilities are not displayed in \uicontrol Library, you
should add the \uicontrol QtQuick3D module to your project, as described in
\l {Adding and Removing Modules}.
For more information on using the shaders, see For more information on using the shaders, see
\l {Creating Custom Effects and Materials}. \l {Creating Custom Effects and Materials}.

View File

@@ -1,85 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Design Studio 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.
**
****************************************************************************/
/*!
\page studio-3d-design-mode.html
\if defined (qtdesignstudio)
\previouspage studio-3d.html
\else
\previouspage studio-importing-3d.html
\endif
\nextpage studio-3d-editor.html
\title Editing 3D Assets in Design Mode
\QDS opens QML files that contain 3D scenes in the Design mode and the
scenes in \uicontrol {3D Editor}. You can add imported 3D assets to projects
and edit them to create scenes and states, as well as the transitions
between them. The other views enable you to select QML types to use in the
scene, specify properties for them, and view them in a tree structure,
as well as to create connections and browse projects and files.
\image studio-editing-3d-scenes.png "Views for editing 3D assets in Design mode"
To open the following views, select \uicontrol View > \uicontrol Views:
\list
\li \uicontrol {3D Editor} (1) is the working area where you create the
scene, position the model, light and camera, as well as move, rotate
and scale items. For more information on how to edit 3D scenes, see
\l {3D Editor}.
\li \uicontrol {Form Editor} (2) is where you see the scene projected by
the camera.
\li \uicontrol {Library} (3) displays the building blocks that you
can use to create scenes: predefined Qt Quick 3D Components,
Qt Quick Controls, your own 3D assets that you import to the
project, and other assets. For more information, see \l {Adding 3D
Views}.
\li \uicontrol {Navigator} (4) displays the items in the current QML
file as a tree structure. For more information, see
\l {Navigator}.
\li \uicontrol {Properties} (5) organizes the properties of the
selected item. You can change the properties also in \uicontrol
{Text Editor}. For more information, see
\l {Specifying Component Properties}.
\li \uicontrol Connections (6) enables you to create connections
between objects, signals, and object properties. For more
information, see \l{Adding Connections}.
\li \uicontrol States displays the different states of the item. QML
states typically describe user interface configurations, such as the
UI controls, their properties and behavior and the available
actions. For more information, see \l {Adding States}.
\li \uicontrol Timeline provides a timeline and keyframe based
editor that enables you to animate the properties of components.
For more information, see \l {Creating Animations}.
\endlist
For more information, watch the following video:
\youtube w1yhDl93YI0
For more information on other views, see
\l {Design Views}.
*/

View File

@@ -41,11 +41,11 @@
When you import 3D scenes from files that you exported from 3D graphics When you import 3D scenes from files that you exported from 3D graphics
tools, you also import a \l{Using Scene Camera}{scene camera}, tools, you also import a \l{Using Scene Camera}{scene camera},
\l{Using Lights}{light}, \l{Adding Models}{model}, and \l{Using Lights}{light}, \l{Adding 3D Models}{model}, and
\l {Using Materials and Shaders}{materials}. If your scene did not contain \l {Using Materials and Shaders}{materials}. If your scene did not contain
them, you can add the corresponding \l {Using 3D Components}{Qt Quick 3D} them, you can add the corresponding \l {Using 3D Components}{Qt Quick 3D}
components from \l Library > \uicontrol Components > \uicontrol QtQuick3D > components from \l Library > \uicontrol Components > \inlineimage plus.png
\uicontrol {Qt Quick 3D}. > \uicontrol QtQuick3D > \uicontrol {Qt Quick 3D}.
You can use the \l{Summary of the 3D Editor Toolbar Buttons}{toolbar buttons} You can use the \l{Summary of the 3D Editor Toolbar Buttons}{toolbar buttons}
to \e transform 3D components and manipulate the 3D scene. Transformation to \e transform 3D components and manipulate the 3D scene. Transformation

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -32,16 +32,15 @@
\title Applying 3D Effects \title Applying 3D Effects
\QDS provides a set of Qt Quick 3D effects that inherit the types in the \QDS provides a set of 3D effects, which are visible in \l {Form Editor}.
\l {Qt Quick 3D Effects QML Types}{Qt Quick 3D Effects} module. To apply a visual effect to a scene, drag-and-drop an effect from \l Library
> \uicontrol Components > \uicontrol QtQuick3D > \uicontrol {Qt Quick 3D Effects}
To apply a visual effect to a scene, drag-and-drop an effect from to a \uicontrol View3D component in \l Navigator. You can apply multiple
the \uicontrol {Qt Quick 3D Effects} tab in \uicontrol Library to a
\uicontrol {View 3D} object in \uicontrol Navigator. You can apply multiple
effects to a scene. Select the \uicontrol {Scene Environment} component in effects to a scene. Select the \uicontrol {Scene Environment} component in
\uicontrol Navigator to view the applied effects in \uicontrol Properties > \uicontrol Navigator to view the applied effects in \l Properties >
\uicontrol {Scene Environment} > \uicontrol Effect. The effects are visible \uicontrol {Scene Environment} > \uicontrol Effect. If the effects are not
in the \uicontrol {Form Editor} view. displayed in \l Library, you should add the \uicontrol QtQuick3D.Effects
module to your project, as described in \l {Adding and Removing Modules}.
See the following table for available effects and example images. See the following table for available effects and example images.
@@ -136,9 +135,9 @@
camera where the content is in perfect focus. camera where the content is in perfect focus.
The \uicontrol {Focus Range} property specifies the distance around the The \uicontrol {Focus Range} property specifies the distance around the
\uicontrol {Focus Distance} where items are fully in focus. The focus \uicontrol {Focus Distance} where components are fully in focus. The
then fades away to fully blurred by the same distance on both the near focus then fades away to fully blurred by the same distance on both the
and far sides. near and far sides.
\row \row
\li Desaturate \li Desaturate
@@ -232,9 +231,9 @@
\row \row
\li Gaussian Blur \li Gaussian Blur
\li \image effect-gaussian-blur.png "The Gaussian Blur effect" \li \image effect-gaussian-blur.png "The Gaussian Blur effect"
\li A two-pass gaussian blur effect that blurs all objects in the scene \li A two-pass gaussian blur effect that blurs all components in the
evenly. To keep the effect performant, large blur amount produces a scene evenly. To keep the effect performant, large blur amount produces
mosaic result instead of smooth blurriness. a mosaic result instead of smooth blurriness.
The \uicontrol Amount property defines the strength of the blur. The \uicontrol Amount property defines the strength of the blur.
@@ -272,7 +271,7 @@
\li Motion Blur \li Motion Blur
\li \image effect-motion-blur.png "The Motion Blur effect" \li \image effect-motion-blur.png "The Motion Blur effect"
\li A motion blur effect that creates an apparent streaking for rapidly \li A motion blur effect that creates an apparent streaking for rapidly
moving objects in the scene. moving components in the scene.
\note Only has a visible effect if the background of the scene is set to \note Only has a visible effect if the background of the scene is set to
be transparent in the \uicontrol {Background Mode} field of the be transparent in the \uicontrol {Background Mode} field of the
@@ -351,21 +350,21 @@
focus bar in normalized coordinates. focus bar in normalized coordinates.
The \uicontrol {Focus Width} property defines a normalized range for The \uicontrol {Focus Width} property defines a normalized range for
Focus Position. Objects within this range will be in focus. Focus Position. Components within this range will be in focus.
The \uicontrol {Blur Amount} property defines the amount of blur. The \uicontrol {Blur Amount} property defines the amount of blur.
Amounts above 4 may cause artifacts. Amounts above 4 may cause artifacts.
The \uicontrol Vertical property changes the direction of the effect The \uicontrol Vertical property changes the direction of the effect
from horizontal to vertical, while the \uicontrol Inverted property from horizontal to vertical, while the \uicontrol Inverted property
inverts the blur area, causing the center of the object to become inverts the blur area, causing the center of the component to become
blurred. blurred.
\row \row
\li Vignette \li Vignette
\li \image effect-vignette.png "The Vignette effect" \li \image effect-vignette.png "The Vignette effect"
\li A vignette effect that reduces brightness towards the periphery of \li A vignette effect that reduces brightness towards the periphery of
an object. a component.
The \uicontrol Strength property defines the strength of vignetting, The \uicontrol Strength property defines the strength of vignetting,
while \uicontrol Radius specifies its size. while \uicontrol Radius specifies its size.

View File

@@ -30,7 +30,7 @@
\nextpage quick-converting-ui-projects.html \nextpage quick-converting-ui-projects.html
\else \else
\previouspage exporting-from-maya.html \previouspage exporting-from-maya.html
\nextpage studio-3d-design-mode.html \nextpage studio-3d-editor.html
\endif \endif
\title Importing 3D Assets \title Importing 3D Assets

View File

@@ -34,10 +34,12 @@
Light components are the primary source of lighting in a \QDS scene. Light components are the primary source of lighting in a \QDS scene.
As a secondary light source, you can use \l{Using Image-based Lighting} As a secondary light source, you can use \l{Using Image-based Lighting}
{image-based lighting}. {image-based lighting}. If the light components are not displayed in
\l Library, you should add the \uicontrol QtQuick3D module to your project,
as described in \l {Adding and Removing Modules}.
By default, all imported scenes are created with one directional light. By default, all imported scenes are created with one directional light.
You can use the following \l{Qt Quick 3D} components to add lights: You can use the following components to add lights:
\list \list
\li \l{DirectionalLight}{Light Directional} \li \l{DirectionalLight}{Light Directional}
@@ -116,8 +118,8 @@
Turn up the quadratic fade to increase the rate at which the lighting effect Turn up the quadratic fade to increase the rate at which the lighting effect
dims on surfaces that are far away from the light. The value 1.0 means that dims on surfaces that are far away from the light. The value 1.0 means that
the point light fade exactly follows the inverse square law. For example, the point light fade exactly follows the inverse square law. For example,
when the distance to an object doubles, the light intensity decreases to one when the distance to a component doubles, the light intensity decreases to
fourth. one fourth.
Aside from fade, a point light has the same properties as a directional Aside from fade, a point light has the same properties as a directional
light. light.
@@ -142,14 +144,14 @@
An area light is similar to the directional light. However, instead of An area light is similar to the directional light. However, instead of
emitting an equally bright light across the whole scene, the area light emitting an equally bright light across the whole scene, the area light
emits directional light from a rectangle shaped object. You can set the emits directional light from a rectangle shaped component. You can set the
\uicontrol Width and \uicontrol Height properties to determine the size \uicontrol Width and \uicontrol Height properties to determine the size
of the area light. of the area light.
Aside from the size, an area light has the same properties as a directional Aside from the size, an area light has the same properties as a directional
light. light.
The image below shows an example on how to light an object with different The image below shows an example on how to light a component with different
colors using two different area lights. colors using two different area lights.
\image studio-3d-area-light.png \image studio-3d-area-light.png
@@ -168,7 +170,7 @@
\uicontrol {Shadow filter} property. \uicontrol {Shadow filter} property.
Tweak the \uicontrol {Shadow bias} property value by small amounts Tweak the \uicontrol {Shadow bias} property value by small amounts
if you see objects casting shadows on themselves. if you see components casting shadows on themselves.
To specify the quality of the shadow map created for shadow rendering, set To specify the quality of the shadow map created for shadow rendering, set
the \uicontrol {Shadow map quality} property. Lower quality uses less the \uicontrol {Shadow map quality} property. Lower quality uses less

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -220,11 +220,11 @@
\section1 Applying Materials to Models \section1 Applying Materials to Models
To apply materials to models: To apply materials to \l {Adding 3D Models}{models}:
\list 1 \list 1
\li Drag and drop a material component from the \uicontrol Library to a \li Drag and drop a material component from \l Library to a model
Model component in the \uicontrol Navigator. component in \l Navigator.
\li Select the Model component. \li Select the Model component.
\li In the \uicontrol Properties view, select the material for the model \li In the \uicontrol Properties view, select the material for the model
in the \uicontrol Materials list. in the \uicontrol Materials list.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -33,12 +33,15 @@
\title Using 3D Materials \title Using 3D Materials
\QDS provides a set of pregenerated Qt Quick 3D materials that can be used \QDS provides a set of pregenerated Qt Quick 3D materials that can be used
to create good-looking models quickly and easily. to create good-looking \l {Adding 3D Models}{models} quickly and easily.
To apply a 3D material to a component, drag-and-drop a material from the To apply a 3D material to a component, drag-and-drop a material from
\uicontrol {Qt Quick 3D Materials} tab of \uicontrol Library to a model \l Library > \uicontrol Components > \uicontrol QtQuick3D >
component in \uicontrol Navigator. The materials you add to the model are \uicontrol {Qt Quick 3D Materials} to a model component in \l Navigator.
listed in the model component's \uicontrol Properties view. The materials you add to the model are listed in the model component's
\l Properties view. If the 3D materials are not displayed in \l Library,
you should add the \uicontrol QtQuick3D.Materials module to your project, as
described in \l {Adding and Removing Modules}.
Each material has its own set of properties that can be used to further Each material has its own set of properties that can be used to further
define the appearance of the material. For each material the \uicontrol define the appearance of the material. For each material the \uicontrol

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -30,16 +30,24 @@
\previouspage studio-3d-node.html \previouspage studio-3d-node.html
\nextpage studio-3d-materials.html \nextpage studio-3d-materials.html
\title Adding Models \title Adding 3D Models
\QDS \l Library features some built-in primitive 3D models. This allows you
to add cubes, cones, cylinders, and planes (rectangles) to your scene.
\image studio-3d-models.png
A Model component loads mesh data from a file. You can modify how the A Model component loads mesh data from a file. You can modify how the
component is shaded by adding materials to the model. component is shaded by adding \l{Using 3D Materials}{materials} to the model.
A model can load static meshes from storage or one of the built-in primitive You can drag-and-drop a model from \uicontrol Library > \uicontrol Components
types: cube, cone, cylinder, plane (rectangle) or sphere. You can drag and > \uicontrol QtQuick3D > \uicontrol {Qt Quick 3D} to \l {3D Editor} or to
drop a model from the \uicontrol Library to a 3D scene. \l Navigator > \uicontrol {Scene Environment} > \uicontrol Scene. If the
models are not displayed in \uicontrol Library, you should add the
\uicontrol QtQuick3D module to your project, as described in
\l {Adding and Removing Modules}.
\image studio-qtquick-3d-components.png "Library view QML Types tab Qt Quick 3D section" \image studio-qtquick-3d-components.png "The Qt Quick 3D section in Library"
You can change the model type in the \uicontrol Source field in the You can change the model type in the \uicontrol Source field in the
\uicontrol Properties view. Select the \inlineimage plus.png \uicontrol Properties view. Select the \inlineimage plus.png

View File

@@ -30,13 +30,19 @@
\title Setting Group Properties \title Setting Group Properties
The \uicontrol Group component is a \uicontrol Node type that can be used to The \uicontrol Group component is a \uicontrol Node component that can be
wrap other objects for the purpose of grouping them. This allows you to used to wrap other objects for the purpose of grouping them. This allows you
transform and set the opacity and visibility of multiple 3D components in to transform and set the opacity and visibility of multiple 3D components in
the \uicontrol Properties view simultaneously. To add a \uicontrol Group the \l Properties view simultaneously. To add a \uicontrol Group component
component to your scene, drag-and-drop it from \uicontrol Library > to your scene, drag-and-drop it from \l Library > \uicontrol Components >
\uicontrol {QML Types} > \uicontrol {Qt Quick 3D} to the \uicontrol \uicontrol {QtQuick3D} > \uicontrol {Qt Quick 3D} to the \l {3D Editor} view
{3D Editor} view or to a \uicontrol Scene component in \uicontrol Navigator. or to a \uicontrol Scene component in \l Navigator. If the \uicontrol Group
component is not displayed in\uicontrol Library, you should add the
\uicontrol QtQuick3D module to your project, as described in
\l {Adding and Removing Modules}.
Select the \uicontrol Group component in \uicontrol Navigator to modify its
properties in the \l Properties view.
\section1 Setting Node Opacity and Visibility \section1 Setting Node Opacity and Visibility
@@ -84,6 +90,6 @@
around a point other than its local origin. Pivot values are applied before around a point other than its local origin. Pivot values are applied before
scaling and rotation values. scaling and rotation values.
A line is drawn in the 3D editor from the pivot point to the center of the A line is drawn in \uicontrol {3D Editor} from the pivot point to the center
component to provide a visual connection between them. of the component to provide a visual connection between them.
*/ */

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Design Studio. ** This file is part of Qt Design Studio.
@@ -32,8 +32,9 @@
\title Attaching Textures to Materials \title Attaching Textures to Materials
You can use the Texture 3D QML type to attach textures to materials. You can use the \uicontrol Texture component to attach textures to materials.
You specify an image and how it is mapped to meshes in a 3D scene. You specify an image to use as the source file for the \uicontrol Texture,
and also define how it is mapped to meshes in a 3D scene.
\image studio-qtquick-3d-texture.png "Texture attached to a material in Design mode" \image studio-qtquick-3d-texture.png "Texture attached to a material in Design mode"
@@ -45,7 +46,7 @@
UV mapping is the process of projecting 2D images to the surface of a UV mapping is the process of projecting 2D images to the surface of a
3D model for texture mapping. The letters \e U and \e V denote the axes 3D model for texture mapping. The letters \e U and \e V denote the axes
of the 2D texture, because x, y, and z are already used to denote the of the 2D texture because x, y, and z are already used to denote the
axes of the 3D object in the model space. You can paint the polygons that axes of the 3D object in the model space. You can paint the polygons that
make up a 3D object with color and other surface attributes from a UV make up a 3D object with color and other surface attributes from a UV
texture map. Pixels in the image are assigned to surface mappings on the texture map. Pixels in the image are assigned to surface mappings on the
@@ -112,24 +113,29 @@
\section1 Applying Textures to Materials \section1 Applying Textures to Materials
Drag and drop an image from \uicontrol Library > \uicontrol Assets Drag-and-drop an image from \l Library > \uicontrol Assets on a material to
on a material to create a texture component. Dragging an image create a texture component. Dragging an image to a default or principled
to a default or principled material opens a material opens a \uicontrol {Select Texture Property} dialog. You can select
\uicontrol {Select Texture Property} dialog. You can select the the property to attach the texture to in the \uicontrol {Set texture to property}
property to attach the texture to in the \uicontrol {Set texture to property} field. For a custom material, you must assign the texture to a map. If the
field. For a custom material, you must assign the texture to a map. \uicontrol Texture component is not displayed in \uicontrol Library, you
should add the \uicontrol QtQuick3D module to your project, as described in
\l {Adding and Removing Modules}.
To use Texture components to apply textures to materials: To use Texture components to apply textures to materials, drag-and-drop a
Texture component from \l Library to a material component in \l Navigator.
The new texture should now be visible in \l {Form Editor} and \l {3D Editor}.
\note If the colors in your texture are not visualized correctly, you should
check the color in the \uicontrol Diffuse property of the material and try
changing it to white (#ffffff).
\image studio-qtquick-3d-material-texture.png "Material properties"
To change the source file for the texture, select the \uicontrol Texture
component in \uicontrol Navigator, go to the \uicontrol Properties view, and
specify a new image to use in the \uicontrol Source field.
\image studio-qtquick-3d-texture-properties.png "Texture properties"
\list 1
\li Drag and drop a Texture component from the \uicontrol Library to a
material component in the \uicontrol Navigator.
\li In the \uicontrol Properties view, specify the image to use in the
\uicontrol Source field.
\image studio-qtquick-3d-texture-properties.png "Texture properties"
\li Select the material component and specify the id of the texture to
use in the \uicontrol Properties view, \uicontrol {Diffuse map}
field.
\image studio-qtquick-3d-material-texture.png "Material properties"
\endlist \endlist
*/ */

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Design Studio documentation. ** This file is part of the Qt Design Studio documentation.
@@ -31,24 +31,23 @@
\title Adding 3D Views \title Adding 3D Views
To create a Qt Quick 3D UI project, we recommend using a \uicontrol To create a Qt Quick 3D UI project, we recommend using a \uicontrol
{Qt Quick 3D Application Template} wizard template that imports the {Qt Quick 3D Application Template} wizard template that adds the
\l{Qt Quick 3D} QML types to the \uicontrol {QML Types} tab in \l {Using 3D Components}{Qt Quick 3D} components to \l Library and contains
\uicontrol Library and contains a 3D view. A 3D view type includes a a 3D view. A 3D view component includes a \l {Setting Scene Environment}
\l {Setting Scene Environment}{scene environment} as well as a scene {scene environment} as well as a scene \l {Using Lights}{light},
\l {Using Lights}{light}, \l {Using Scene Camera}{camera}, and \l {Adding \l {Using Scene Camera}{camera}, and \l {Adding 3D Models}{model}. A default
Models}{model}. A default \l {Using Materials and Shaders}{material} is \l {Using Materials and Shaders}{material} is attached to the model. You can
attached to the model. You can attach \l {Attaching Textures to Materials} attach \l {Attaching Textures to Materials}{textures} to materials. For more
{textures} to materials. For more information about creating projects, see information about creating projects, see \l{Creating Projects}.
\l{Creating Projects}.
To add a 3D view to some other kind of project and to display the Qt Quick To add a 3D view to some other kind of a project, you should first add the
3D QML types in \uicontrol Library, select \uicontrol Library > \uicontrol QtQuick3D module to \uicontrol Library, as described in
\uicontrol {QML Imports} > \uicontrol {Add Import} > \uicontrol QtQuick3D. \l {Adding and Removing Modules}.
\image studio-qtquick-3d-components.png "Qt Quick 3D components in Library" \image studio-qtquick-3d-components.png "Qt Quick 3D components in Library"
After importing the Qt Quick 3D QML types, drag and drop a \uicontrol You can now drag-and-drop a \uicontrol View3D component to \l Navigator or
View3D type to \uicontrol Navigator or to \uicontrol {Form Editor}. to \l {Form Editor}.
\image studio-navigator-view3d.png "A View 3D component in the Navigator" \image studio-navigator-view3d.png "A View 3D component in the Navigator"
@@ -64,7 +63,7 @@
Similarly to other components, you can select a 3D view in \uicontrol Similarly to other components, you can select a 3D view in \uicontrol
Navigator or \uicontrol {3D Editor} and modify its property values in the Navigator or \uicontrol {3D Editor} and modify its property values in the
\uicontrol Properties view. Use the properties in the \uicontrol View3D \uicontrol Properties view. Use the properties in the \uicontrol View3D
tab to set some properties specific to a 3D view component. tab to set properties specific to a 3D view component.
\image studio-qtquick-3d-view.png "View 3D component properties" \image studio-qtquick-3d-view.png "View 3D component properties"
@@ -78,7 +77,7 @@
The \uicontrol {Import Scene} property defines the ID of the component to The \uicontrol {Import Scene} property defines the ID of the component to
render to \uicontrol {Form Editor}. The component does not have to be a render to \uicontrol {Form Editor}. The component does not have to be a
child of a 3D view type. This referenced component becomes a sibling to child of a 3D view component. This referenced component becomes a sibling to
child items of a 3D view, if there are any. You can use this property, for child items of a 3D view, if there are any. You can use this property, for
example, to create a split screen view showing your scene from multiple example, to create a split screen view showing your scene from multiple
cameras. For more information on how to to use a 3D view to show a scene cameras. For more information on how to to use a 3D view to show a scene
@@ -86,5 +85,4 @@
\note The \uicontrol {Import Scene} property can only be set once. \note The \uicontrol {Import Scene} property can only be set once.
Subsequent changes will have no effect. Subsequent changes will have no effect.
*/ */

View File

@@ -27,7 +27,7 @@
\page studio-3d.html \page studio-3d.html
\previouspage quick-states.html \previouspage quick-states.html
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\nextpage studio-3d-design-mode.html \nextpage studio-3d-view.html
\else \else
\nextpage exporting-3d-assets.html \nextpage exporting-3d-assets.html
\endif \endif
@@ -44,9 +44,9 @@
When you import 3D scenes from files that you exported from 3D graphics When you import 3D scenes from files that you exported from 3D graphics
tools, you also import the camera, light, model, and materials as 3D tools, you also import the camera, light, model, and materials as 3D
components. If your scene did not contain them, you can add predefined components. If your scene did not contain them, you can add predefined
Qt Quick 3D components to it and edit their properties to fit your needs. 3D components to it and edit their properties to fit your needs.
The following topics contain information about working with Qt Quick 3D: The following topics contain information about editing 3D scenes:
\list \list
\if defined (qtcreator) \if defined (qtcreator)
@@ -62,12 +62,6 @@
applications and stored in one of the supported file formats. applications and stored in one of the supported file formats.
You can then edit them in the Design mode. You can then edit them in the Design mode.
\endif \endif
\li \l {Editing 3D Assets in Design Mode}
\QDS opens QML files that contain 3D scenes in the Design mode and
the scenes in \uicontrol {3D Editor}. You can add imported 3D assets
to projects as 3D components.
\li \l{Adding 3D Views} \li \l{Adding 3D Views}
You can drag and drop 3D components from \uicontrol Library You can drag and drop 3D components from \uicontrol Library
@@ -78,4 +72,9 @@
You can speficy properties for 3D components, such as cameras, You can speficy properties for 3D components, such as cameras,
lights, materials, and shaders, in the \uicontrol Properties view. lights, materials, and shaders, in the \uicontrol Properties view.
\endlist \endlist
For more information, watch the following video:
\youtube w1yhDl93YI0
*/ */

View File

@@ -1430,7 +1430,7 @@ class DumperBase():
intSize = 4 intSize = 4
ptrSize = self.ptrSize() ptrSize = self.ptrSize()
if self.qtVersion() >= 0x060000: if self.qtVersion() >= 0x060000:
# Size of QObjectData: 7 pointer + 2 int # Size of QObjectData: 9 pointer + 2 int
# - vtable # - vtable
# - QObject *q_ptr; # - QObject *q_ptr;
# - QObject *parent; # - QObject *parent;
@@ -1438,7 +1438,8 @@ class DumperBase():
# - uint isWidget : 1; etc... # - uint isWidget : 1; etc...
# - int postedEvents; # - int postedEvents;
# - QDynamicMetaObjectData *metaObject; # - QDynamicMetaObjectData *metaObject;
extra = self.extractPointer(dd + 7 * ptrSize + 2 * intSize) # - QBindingStorage bindingStorage;
extra = self.extractPointer(dd + 9 * ptrSize + 2 * intSize)
if extra == 0: if extra == 0:
return False return False
@@ -1780,7 +1781,10 @@ class DumperBase():
def metaString(self, metaObjectPtr, index, revision): def metaString(self, metaObjectPtr, index, revision):
ptrSize = self.ptrSize() ptrSize = self.ptrSize()
stringdata = self.extractPointer(toInteger(metaObjectPtr) + ptrSize) stringdataOffset = ptrSize
if self.isWindowsTarget():
stringdataOffset += ptrSize # indirect super data member
stringdata = self.extractPointer(toInteger(metaObjectPtr) + stringdataOffset)
def unpackString(base, size): def unpackString(base, size):
try: try:
@@ -1891,7 +1895,13 @@ class DumperBase():
extraData = 0 extraData = 0
if qobjectPtr: if qobjectPtr:
dd = self.extractPointer(qobjectPtr + ptrSize) dd = self.extractPointer(qobjectPtr + ptrSize)
if self.qtVersion() >= 0x50000: if self.qtVersion() >= 0x60000:
(dvtablePtr, qptr, parent, children, bindingStorageData, bindingStatus,
flags, postedEvents, dynMetaObjectPtr, # Up to here QObjectData.
extraData, threadDataPtr, connectionListsPtr,
sendersPtr, currentSenderPtr) \
= self.split('pp{@QObject*}{@QList<@QObject *>}ppIIp' + 'ppppp', dd)
elif self.qtVersion() >= 0x50000:
(dvtablePtr, qptr, parent, children, flags, postedEvents, (dvtablePtr, qptr, parent, children, flags, postedEvents,
dynMetaObjectPtr, # Up to here QObjectData. dynMetaObjectPtr, # Up to here QObjectData.
extraData, threadDataPtr, connectionListsPtr, extraData, threadDataPtr, connectionListsPtr,

View File

@@ -2101,7 +2101,9 @@ def qdumpHelper__QVariant6(d, value):
_, data = d.split('8s{%s}' % typeName, ptr) _, data = d.split('8s{%s}' % typeName, ptr)
d.putItem(data) d.putItem(data)
else: else:
d.putItem(d.createValue(data, typeName)) val = d.createValue(data, typeName)
val.laddress = value.laddress
d.putItem(val)
d.putBetterType('@QVariant (%s)' % typeName) d.putBetterType('@QVariant (%s)' % typeName)
@@ -2826,14 +2828,14 @@ def qdump_64__QJSValue_6(d, value):
elif typ > 7: elif typ > 7:
val = d.Value(d) val = d.Value(d)
val.ldata = struct.pack('q', dd ^ 0xfffc000000000000) val.ldata = struct.pack('q', dd ^ 0xfffc000000000000)
val.type = d.createType('double') val._type = d.createType('double')
d.putItem(val) d.putItem(val)
d.putType(value.type.name + ' (double)') d.putType(value.type.name + ' (double)')
elif typ <= 3: # Heap elif typ <= 3: # Heap
if dd & 1: # String if dd & 1: # String
val = d.Value(d) val = d.Value(d)
val.ldata = struct.pack('q', dd & ~1) val.ldata = struct.pack('q', dd & ~1)
val.type = d.createType('@QString*') val._type = d.createType('@QString*')
d.putItem(val) d.putItem(val)
d.putType(value.type.name + ' (QString)') d.putType(value.type.name + ' (QString)')
else: else:

View File

@@ -78,7 +78,6 @@ ScrollView {
property string importToRemove: "" property string importToRemove: ""
property string importToAdd: "" property string importToAdd: ""
property var currentItem: null
// called from C++ to close context menu on focus out // called from C++ to close context menu on focus out
function closeContextMenu() function closeContextMenu()
@@ -136,9 +135,9 @@ ScrollView {
StudioControls.MenuItem { StudioControls.MenuItem {
id: importMenuItem id: importMenuItem
text: qsTr("Import Module: ") + importToAdd text: qsTr("Add Module: ") + importToAdd
enabled: currentItem enabled: importToAdd !== ""
onTriggered: rootView.addImportForItem(currentItem) onTriggered: rootView.addImportForItem(importToAdd)
} }
} }
} }
@@ -159,8 +158,6 @@ ScrollView {
: StudioTheme.Values.themeTextColor : StudioTheme.Values.themeTextColor
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: 0
bottomPadding: 0
expanded: importExpanded expanded: importExpanded
expandOnClick: false expandOnClick: false
onToggleExpand: { onToggleExpand: {
@@ -184,8 +181,8 @@ ScrollView {
hideHeader: categoryModel.rowCount() <= 1 hideHeader: categoryModel.rowCount() <= 1
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: 0 addTopPadding: categoryModel.rowCount() > 1
bottomPadding: 0 addBottomPadding: index != categoryModel.rowCount() - 1
caption: categoryName + " (" + itemModel.rowCount() + ")" caption: categoryName + " (" + itemModel.rowCount() + ")"
visible: categoryVisible visible: categoryVisible
expanded: categoryExpanded expanded: categoryExpanded
@@ -213,10 +210,7 @@ ScrollView {
onShowContextMenu: { onShowContextMenu: {
if (!itemUsable) { if (!itemUsable) {
importToAdd = itemRequiredImport importToAdd = itemRequiredImport
if (importToAdd !== "") { itemContextMenu.popup()
currentItem = itemLibraryEntry
itemContextMenu.popup()
}
} }
} }
} }

View File

@@ -40,15 +40,15 @@ Item {
property alias showArrow: arrow.visible property alias showArrow: arrow.visible
property int leftPadding: 8 property int leftPadding: 8
property int topPadding: 4
property int rightPadding: 0 property int rightPadding: 0
property int bottomPadding: 4
property bool expanded: true property bool expanded: true
property int level: 0 property int level: 0
property int levelShift: 10 property int levelShift: 10
property bool hideHeader: false property bool hideHeader: false
property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead
property bool addTopPadding: true
property bool addBottomPadding: true
onHideHeaderChanged: onHideHeaderChanged:
{ {
@@ -120,11 +120,12 @@ Item {
readonly property alias contentItem: row readonly property alias contentItem: row
implicitHeight: Math.round(row.height + header.height + topRow.height + bottomRow.height) implicitHeight: Math.round(row.height + header.height + topSpacer.height + bottomSpacer.height)
Row {
id: topRow Item {
height: StudioTheme.Values.sectionHeadSpacerHeight id: topSpacer
height: addTopPadding && row.height > 0 ? StudioTheme.Values.sectionHeadSpacerHeight : 0
anchors.top: header.bottom anchors.top: header.bottom
} }
@@ -134,12 +135,12 @@ Item {
anchors.leftMargin: section.leftPadding anchors.leftMargin: section.leftPadding
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: section.rightPadding anchors.rightMargin: section.rightPadding
anchors.top: topRow.bottom anchors.top: topSpacer.bottom
} }
Row { Item {
id: bottomRow id: bottomSpacer
height: StudioTheme.Values.sectionHeadSpacerHeight height: addBottomPadding && row.height > 0 ? StudioTheme.Values.sectionHeadSpacerHeight : 0
anchors.top: row.bottom anchors.top: row.bottom
} }

View File

@@ -1,15 +1,16 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import sys
import os import os
from pathlib import Path
import sys
from %{PySideVersion}.QtGui import QGuiApplication from %{PySideVersion}.QtGui import QGuiApplication
from %{PySideVersion}.QtQml import QQmlApplicationEngine from %{PySideVersion}.QtQml import QQmlApplicationEngine
if __name__ == "__main__": if __name__ == "__main__":
app = QGuiApplication(sys.argv) app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine() engine = QQmlApplicationEngine()
engine.load(os.path.join(os.path.dirname(__file__), "main.qml")) engine.load(os.fspath(Path(__file__).resolve().parent / "main.qml"))
if not engine.rootObjects(): if not engine.rootObjects():
sys.exit(-1) sys.exit(-1)
sys.exit(app.exec_()) sys.exit(app.exec_())

View File

@@ -1,7 +1,7 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import sys
import os import os
from pathlib import Path
import sys
@if '%{BaseCB}' === 'QWidget' @if '%{BaseCB}' === 'QWidget'
from %{PySideVersion}.QtWidgets import QApplication, QWidget from %{PySideVersion}.QtWidgets import QApplication, QWidget
@@ -27,12 +27,13 @@ class %{Class}:
def load_ui(self): def load_ui(self):
loader = QUiLoader() loader = QUiLoader()
path = os.path.join(os.path.dirname(__file__), "form.ui") path = os.fspath(Path(__file__).resolve().parent / "form.ui")
ui_file = QFile(path) ui_file = QFile(path)
ui_file.open(QFile.ReadOnly) ui_file.open(QFile.ReadOnly)
loader.load(ui_file, self) loader.load(ui_file, self)
ui_file.close() ui_file.close()
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication([]) app = QApplication([])
widget = %{Class}() widget = %{Class}()

View File

@@ -972,7 +972,7 @@ private:
continue; continue;
} }
auto pushGraphs = [&](int offset, const GraphLine *endline, const QStringView &style) { auto pushGraphs = [&](int offset, const GraphLine *endline, QStringView style) {
for (GraphLine *pline = m_regionGraph.data(); pline <= endline; ++pline) { for (GraphLine *pline = m_regionGraph.data(); pline <= endline; ++pline) {
// a label can hide a graph // a label can hide a graph
if (pline->graphLineLength <= offset) { if (pline->graphLineLength <= offset) {
@@ -1156,14 +1156,18 @@ void AnsiHighlighter::setOutputFile(const QString &fileName)
return; return;
} }
d->out.setDevice(&d->file); d->out.setDevice(&d->file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->out.setCodec("UTF-8"); d->out.setCodec("UTF-8");
#endif
} }
void AnsiHighlighter::setOutputFile(FILE *fileHandle) void AnsiHighlighter::setOutputFile(FILE *fileHandle)
{ {
d->file.open(fileHandle, QIODevice::WriteOnly); d->file.open(fileHandle, QIODevice::WriteOnly);
d->out.setDevice(&d->file); d->out.setDevice(&d->file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->out.setCodec("UTF-8"); d->out.setCodec("UTF-8");
#endif
} }
void AnsiHighlighter::highlightFile(const QString &fileName, AnsiFormat format, bool useEditorBackground, TraceOptions traceOptions) void AnsiHighlighter::highlightFile(const QString &fileName, AnsiFormat format, bool useEditorBackground, TraceOptions traceOptions)
@@ -1287,7 +1291,9 @@ void AnsiHighlighter::highlightData(QIODevice *dev, AnsiFormat format, bool useE
} }
QTextStream in(dev); QTextStream in(dev);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
in.setCodec("UTF-8"); in.setCodec("UTF-8");
#endif
if (!traceOptions) { if (!traceOptions) {
State state; State state;

View File

@@ -27,7 +27,7 @@ Context *ContextSwitch::context() const
return m_context; return m_context;
} }
void ContextSwitch::parse(const QStringView &contextInstr) void ContextSwitch::parse(QStringView contextInstr)
{ {
if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay")) if (contextInstr.isEmpty() || contextInstr == QLatin1String("#stay"))
return; return;

View File

@@ -25,7 +25,7 @@ public:
int popCount() const; int popCount() const;
Context *context() const; Context *context() const;
void parse(const QStringView &contextInstr); void parse(QStringView contextInstr);
void resolve(const Definition &def); void resolve(const Definition &def);
private: private:

View File

@@ -765,7 +765,7 @@ void DefinitionData::loadSpellchecking(QXmlStreamReader &reader)
} }
} }
bool DefinitionData::checkKateVersion(const QStringView &verStr) bool DefinitionData::checkKateVersion(QStringView verStr)
{ {
const auto idx = verStr.indexOf(QLatin1Char('.')); const auto idx = verStr.indexOf(QLatin1Char('.'));
if (idx <= 0) { if (idx <= 0) {

View File

@@ -53,7 +53,7 @@ public:
void loadComments(QXmlStreamReader &reader); void loadComments(QXmlStreamReader &reader);
void loadFoldingIgnoreList(QXmlStreamReader &reader); void loadFoldingIgnoreList(QXmlStreamReader &reader);
void loadSpellchecking(QXmlStreamReader &reader); void loadSpellchecking(QXmlStreamReader &reader);
bool checkKateVersion(const QStringView &verStr); bool checkKateVersion(QStringView verStr);
void resolveIncludeKeywords(); void resolveIncludeKeywords();

View File

@@ -19,7 +19,7 @@
using namespace KSyntaxHighlighting; using namespace KSyntaxHighlighting;
static Theme::TextStyle stringToDefaultFormat(const QStringView &str) static Theme::TextStyle stringToDefaultFormat(QStringView str)
{ {
if (!str.startsWith(QLatin1String("ds"))) if (!str.startsWith(QLatin1String("ds")))
return Theme::Normal; return Theme::Normal;

View File

@@ -130,9 +130,7 @@ void HtmlHighlighter::highlightData(QIODevice *dev, const QString &title)
*d->out << "\"><pre>\n"; *d->out << "\"><pre>\n";
QTextStream in(dev); QTextStream in(dev);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
in.setEncoding(QStringConverter::Utf8);
#else
in.setCodec("UTF-8"); in.setCodec("UTF-8");
#endif #endif
while (!in.atEnd()) { while (!in.atEnd()) {

View File

@@ -16,7 +16,7 @@
using namespace KSyntaxHighlighting; using namespace KSyntaxHighlighting;
bool KeywordList::contains(const QStringView &str, Qt::CaseSensitivity caseSensitive) const bool KeywordList::contains(QStringView str, Qt::CaseSensitivity caseSensitive) const
{ {
/** /**
* get right vector to search in * get right vector to search in
@@ -26,7 +26,7 @@ bool KeywordList::contains(const QStringView &str, Qt::CaseSensitivity caseSensi
/** /**
* search with right predicate * search with right predicate
*/ */
return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), QStringView(str), [caseSensitive](const QStringView &a, const QStringView &b) { return std::binary_search(vectorToSearch.begin(), vectorToSearch.end(), QStringView(str), [caseSensitive](QStringView a, QStringView b) {
return a.compare(b, caseSensitive) < 0; return a.compare(b, caseSensitive) < 0;
}); });
} }
@@ -92,7 +92,7 @@ void KeywordList::initLookupForCaseSensitivity(Qt::CaseSensitivity caseSensitive
/** /**
* sort with right predicate * sort with right predicate
*/ */
std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive](const QStringView &a, const QStringView &b) { std::sort(vectorToSort.begin(), vectorToSort.end(), [caseSensitive](QStringView a, QStringView b) {
return a.compare(b, caseSensitive) < 0; return a.compare(b, caseSensitive) < 0;
}); });
} }

View File

@@ -53,10 +53,10 @@ public:
} }
/** Checks if @p str is a keyword in this list. */ /** Checks if @p str is a keyword in this list. */
bool contains(const QStringView &str) const { return contains(str, m_caseSensitive); } bool contains(QStringView str) const { return contains(str, m_caseSensitive); }
/** Checks if @p str is a keyword in this list, overriding the global case-sensitivity setting. */ /** Checks if @p str is a keyword in this list, overriding the global case-sensitivity setting. */
bool contains(const QStringView &str, Qt::CaseSensitivity caseSensitive) const; bool contains(QStringView str, Qt::CaseSensitivity caseSensitive) const;
void load(QXmlStreamReader &reader); void load(QXmlStreamReader &reader);
void setCaseSensitivity(Qt::CaseSensitivity caseSensitive); void setCaseSensitivity(Qt::CaseSensitivity caseSensitive);

View File

@@ -182,7 +182,7 @@ void Rule::loadAdditionalWordDelimiters(QXmlStreamReader &reader)
m_weakDeliminator = reader.attributes().value(QLatin1String("weakDeliminator")).toString(); m_weakDeliminator = reader.attributes().value(QLatin1String("weakDeliminator")).toString();
} }
Rule::Ptr Rule::create(const QStringView &name) Rule::Ptr Rule::create(QStringView name)
{ {
if (name == QLatin1String("AnyChar")) if (name == QLatin1String("AnyChar"))
return std::make_shared<AnyChar>(); return std::make_shared<AnyChar>();

View File

@@ -89,7 +89,7 @@ public:
virtual MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const = 0; virtual MatchResult doMatch(const QString &text, int offset, const QStringList &captures) const = 0;
static Rule::Ptr create(const QStringView &name); static Rule::Ptr create(QStringView name);
protected: protected:
virtual bool doLoad(QXmlStreamReader &reader); virtual bool doLoad(QXmlStreamReader &reader);

View File

@@ -15,7 +15,7 @@ namespace KSyntaxHighlighting
namespace Xml namespace Xml
{ {
/** Parse a xs:boolean attribute. */ /** Parse a xs:boolean attribute. */
inline bool attrToBool(const QStringView &str) inline bool attrToBool(QStringView str)
{ {
return str == QLatin1String("1") || str.compare(QString("true"), Qt::CaseInsensitive) == 0; return str == QLatin1String("1") || str.compare(QString("true"), Qt::CaseInsensitive) == 0;
} }

View File

@@ -39,14 +39,13 @@ class AbstractFilePathView : public Utils::SmallStringView
public: public:
constexpr AbstractFilePathView() = default; constexpr AbstractFilePathView() = default;
explicit AbstractFilePathView(const char *const string, const size_type size) noexcept explicit AbstractFilePathView(const char *const string, const size_type size) noexcept
: Utils::SmallStringView(string, size), : AbstractFilePathView{Utils::SmallStringView{string, size}}
m_slashIndex(lastSlashIndex(*this))
{ {
} }
explicit AbstractFilePathView(Utils::SmallStringView filePath) explicit AbstractFilePathView(Utils::SmallStringView filePath)
: Utils::SmallStringView(filePath), : Utils::SmallStringView(filePath)
m_slashIndex(lastSlashIndex(filePath)) , m_slashIndex(lastSlashIndex(filePath))
{ {
} }
@@ -91,9 +90,10 @@ public:
constexpr char separator = Utils::HostOsInfo::isWindowsHost() ? WindowsSlash : '/'; constexpr char separator = Utils::HostOsInfo::isWindowsHost() ? WindowsSlash : '/';
auto foundReverse = std::find(filePath.rbegin(), filePath.rend(), separator); auto foundReverse = std::find(filePath.rbegin(), filePath.rend(), separator);
auto found = foundReverse.base(); auto found = foundReverse.base();
--found;
return std::distance(filePath.begin(), found); auto distance = std::distance(filePath.begin(), found);
return distance - 1;
} }
friend bool operator==(const AbstractFilePathView &first, const AbstractFilePathView &second) friend bool operator==(const AbstractFilePathView &first, const AbstractFilePathView &second)

View File

@@ -64,8 +64,8 @@ template<uint Size>
class BasicSmallString class BasicSmallString
{ {
public: public:
using iterator = SmallStringView::iterator; using const_iterator = Internal::SmallStringIterator<std::random_access_iterator_tag, const char>;
using const_iterator = SmallStringView::const_iterator; using iterator = Internal::SmallStringIterator<std::random_access_iterator_tag, char>;
using reverse_iterator = std::reverse_iterator<iterator>; using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using size_type = std::size_t; using size_type = std::size_t;
@@ -116,11 +116,12 @@ public:
{} {}
explicit BasicSmallString(const_iterator begin, const_iterator end) explicit BasicSmallString(const_iterator begin, const_iterator end)
: BasicSmallString(SmallStringView{begin, end}) : BasicSmallString{std::addressof(*begin), static_cast<std::size_t>(std::distance(begin, end))}
{} {}
explicit BasicSmallString(iterator begin, iterator end) explicit BasicSmallString(iterator begin, iterator end)
: BasicSmallString(SmallStringView{begin, end})
: BasicSmallString{std::addressof(*begin), static_cast<std::size_t>(std::distance(begin, end))}
{} {}
template<typename Type, typename = std::enable_if_t<std::is_pointer<Type>::value>> template<typename Type, typename = std::enable_if_t<std::is_pointer<Type>::value>>

View File

@@ -32,6 +32,7 @@
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <string_view>
namespace Utils { namespace Utils {
@@ -45,45 +46,24 @@ using enable_if_has_char_data_pointer = typename std::enable_if_t<
>, char>::value >, char>::value
, int>; , int>;
class SmallStringView class SmallStringView : public std::string_view
{ {
public: public:
using const_iterator = Internal::SmallStringIterator<std::random_access_iterator_tag, const char>; using std::string_view::string_view;
using iterator = Internal::SmallStringIterator<std::random_access_iterator_tag, char>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using size_type = std::size_t;
constexpr SmallStringView() = default;
constexpr SmallStringView(const char *characterPointer) noexcept
: m_pointer(characterPointer)
, m_size(std::char_traits<char>::length(characterPointer))
{}
constexpr SmallStringView(const char *const string, const size_type size) noexcept
: m_pointer(string)
, m_size(size)
{}
constexpr SmallStringView(const char *const begin, const char *const end) noexcept
: m_pointer(begin)
, m_size(static_cast<std::size_t>(std::distance(begin, end)))
{}
constexpr SmallStringView(const_iterator begin, const_iterator end) noexcept constexpr SmallStringView(const_iterator begin, const_iterator end) noexcept
: m_pointer(begin.data()) : std::string_view{std::addressof(*begin), static_cast<std::size_t>(std::distance(begin, end))}
, m_size(std::size_t(end - begin))
{} {}
constexpr SmallStringView(iterator begin, iterator end) noexcept #ifdef Q_OS_WINDOWS
: m_pointer(begin.data()) constexpr SmallStringView(const char *const begin, const char *const end) noexcept
, m_size(std::size_t(end - begin)) : std::string_view{begin, static_cast<std::size_t>(std::distance(begin, end))}
{} {}
#endif
template<typename String, typename Utils::enable_if_has_char_data_pointer<String> = 0> template<typename String, typename Utils::enable_if_has_char_data_pointer<String> = 0>
constexpr SmallStringView(const String &string) noexcept constexpr SmallStringView(const String &string) noexcept
: m_pointer(string.data()) : std::string_view{string.data(), static_cast<std::size_t>(string.size())}
, m_size(string.size())
{} {}
static constexpr SmallStringView fromUtf8(const char *const characterPointer) static constexpr SmallStringView fromUtf8(const char *const characterPointer)
@@ -91,29 +71,7 @@ public:
return SmallStringView(characterPointer); return SmallStringView(characterPointer);
} }
constexpr constexpr size_type isEmpty() const noexcept { return empty(); }
const char *data() const noexcept
{
return m_pointer;
}
constexpr
size_type size() const noexcept
{
return m_size;
}
constexpr
size_type isEmpty() const noexcept
{
return m_size == 0;
}
constexpr
size_type empty() const noexcept
{
return m_size == 0;
}
constexpr constexpr
SmallStringView mid(size_type position) const noexcept SmallStringView mid(size_type position) const noexcept
@@ -127,28 +85,6 @@ public:
return SmallStringView(data() + position, length); return SmallStringView(data() + position, length);
} }
constexpr
const_iterator begin() const noexcept
{
return data();
}
constexpr
const_iterator end() const noexcept
{
return data() + size();
}
constexpr const_reverse_iterator rbegin() const noexcept
{
return const_reverse_iterator(end());
}
constexpr const_reverse_iterator rend() const noexcept
{
return const_reverse_iterator(begin());
}
constexpr20 operator std::string() const { return std::string(data(), size()); } constexpr20 operator std::string() const { return std::string(data(), size()); }
explicit operator QString() const explicit operator QString() const
@@ -159,7 +95,7 @@ public:
constexpr bool startsWith(SmallStringView subStringToSearch) const noexcept constexpr bool startsWith(SmallStringView subStringToSearch) const noexcept
{ {
if (size() >= subStringToSearch.size()) if (size() >= subStringToSearch.size())
return !std::char_traits<char>::compare(m_pointer, return !std::char_traits<char>::compare(data(),
subStringToSearch.data(), subStringToSearch.data(),
subStringToSearch.size()); subStringToSearch.size());
@@ -168,16 +104,8 @@ public:
constexpr bool startsWith(char characterToSearch) const noexcept constexpr bool startsWith(char characterToSearch) const noexcept
{ {
return m_pointer[0] == characterToSearch; return *begin() == characterToSearch;
} }
constexpr char back() const { return m_pointer[m_size - 1]; }
constexpr char operator[](std::size_t index) { return m_pointer[index]; }
private:
const char *m_pointer = "";
size_type m_size = 0;
}; };
constexpr bool operator==(SmallStringView first, SmallStringView second) noexcept constexpr bool operator==(SmallStringView first, SmallStringView second) noexcept

View File

@@ -237,7 +237,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
QVector<QAction *> actions; QVector<QAction *> actions;
QAction *action = new QAction(); QAction *action = new QAction();
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
action->setToolTip(tr("Copy to Clipboard")); action->setToolTip(QApplication::translate("Clang Code Model Marks", "Copy to Clipboard"));
QObject::connect(action, &QAction::triggered, [diagnostic]() { QObject::connect(action, &QAction::triggered, [diagnostic]() {
const QString text = ClangDiagnosticWidget::createText({diagnostic}, const QString text = ClangDiagnosticWidget::createText({diagnostic},
ClangDiagnosticWidget::InfoBar); ClangDiagnosticWidget::InfoBar);
@@ -250,7 +250,8 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
if (project && isDiagnosticConfigChangable(project, diagnostic)) { if (project && isDiagnosticConfigChangable(project, diagnostic)) {
action = new QAction(); action = new QAction();
action->setIcon(Icons::BROKEN.icon()); action->setIcon(Icons::BROKEN.icon());
action->setToolTip(tr("Disable Diagnostic in Current Project")); action->setToolTip(QApplication::translate("Clang Code Model Marks",
"Disable Diagnostic in Current Project"));
QObject::connect(action, &QAction::triggered, [diagnostic]() { QObject::connect(action, &QAction::triggered, [diagnostic]() {
disableDiagnosticInCurrentProjectConfig(diagnostic); disableDiagnosticInCurrentProjectConfig(diagnostic);
}); });

View File

@@ -38,8 +38,10 @@
#include <android/androidconstants.h> #include <android/androidconstants.h>
#include <ios/iosconstants.h> #include <ios/iosconstants.h>
#include <webassembly/webassemblyconstants.h>
#include <coreplugin/find/itemviewfind.h> #include <coreplugin/find/itemviewfind.h>
#include <coreplugin/icore.h>
#include <projectexplorer/buildaspects.h> #include <projectexplorer/buildaspects.h>
#include <projectexplorer/buildinfo.h> #include <projectexplorer/buildinfo.h>
@@ -58,6 +60,7 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/categorysortfiltermodel.h> #include <utils/categorysortfiltermodel.h>
#include <utils/checkablemessagebox.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/headerviewstretcher.h> #include <utils/headerviewstretcher.h>
#include <utils/infolabel.h> #include <utils/infolabel.h>
@@ -94,11 +97,15 @@ static Q_LOGGING_CATEGORY(cmakeBuildConfigurationLog, "qtc.cmake.bc", QtWarningM
const char CONFIGURATION_KEY[] = "CMake.Configuration"; const char CONFIGURATION_KEY[] = "CMake.Configuration";
const char DEVELOPMENT_TEAM_FLAG[] = "Ios:DevelopmentTeam:Flag"; const char DEVELOPMENT_TEAM_FLAG[] = "Ios:DevelopmentTeam:Flag";
const char PROVISIONING_PROFILE_FLAG[] = "Ios:ProvisioningProfile:Flag"; const char PROVISIONING_PROFILE_FLAG[] = "Ios:ProvisioningProfile:Flag";
const char CMAKE_QT6_TOOLCHAIN_FILE_ARG[] =
"-DCMAKE_TOOLCHAIN_FILE:PATH=%{Qt:QT_INSTALL_PREFIX}/lib/cmake/Qt6/qt.toolchain.cmake";
namespace Internal { namespace Internal {
class CMakeBuildSettingsWidget : public NamedWidget class CMakeBuildSettingsWidget : public NamedWidget
{ {
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeBuildSettingsWidget)
public: public:
CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc); CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc);
@@ -178,6 +185,34 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
m_configModel->flush(); // clear out config cache...; m_configModel->flush(); // clear out config cache...;
}); });
auto clearCMakeConfiguration = new QPushButton(tr("Re-configure with Initial Parameters"));
connect(clearCMakeConfiguration, &QPushButton::clicked, this, [bc]() {
auto *settings = CMakeProjectPlugin::projectTypeSpecificSettings();
bool doNotAsk{!settings->askBeforeReConfigureInitialParams()};
if (!doNotAsk) {
QDialogButtonBox::StandardButton reply = Utils::CheckableMessageBox::question(
nullptr,
tr("Re-configure with Initial Parameters"),
tr("Clear CMake configuration and configure with initial parameters?"),
tr("Do not ask again"),
&doNotAsk,
QDialogButtonBox::Yes | QDialogButtonBox::No,
QDialogButtonBox::Yes);
settings->setAskBeforeReConfigureInitialParams(!doNotAsk);
settings->toSettings(Core::ICore::settings());
if (reply != QDialogButtonBox::Yes) {
return;
}
}
auto cbc = static_cast<CMakeBuildSystem*>(bc->buildSystem());
cbc->clearCMakeCache();
if (ProjectExplorerPlugin::saveModifiedFiles())
cbc->runCMake();
});
auto buildTypeAspect = bc->aspect<BuildTypeAspect>(); auto buildTypeAspect = bc->aspect<BuildTypeAspect>();
connect(buildTypeAspect, &BaseAspect::changed, this, [this, buildTypeAspect]() { connect(buildTypeAspect, &BaseAspect::changed, this, [this, buildTypeAspect]() {
if (!m_buildConfiguration->isMultiConfig()) { if (!m_buildConfiguration->isMultiConfig()) {
@@ -309,6 +344,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
buildDirAspect, buildDirAspect,
bc->aspect<InitialCMakeArgumentsAspect>(), bc->aspect<InitialCMakeArgumentsAspect>(),
bc->aspect<BuildTypeAspect>(), bc->aspect<BuildTypeAspect>(),
QString(), clearCMakeConfiguration,
qmlDebugAspect qmlDebugAspect
}, },
Space(10), Space(10),
@@ -427,7 +463,11 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
this, &CMakeBuildSettingsWidget::updateFromKit); this, &CMakeBuildSettingsWidget::updateFromKit);
connect(m_buildConfiguration, &CMakeBuildConfiguration::enabledChanged, connect(m_buildConfiguration, &CMakeBuildConfiguration::enabledChanged,
this, [this]() { this, [this]() {
setError(m_buildConfiguration->disabledReason()); if (m_buildConfiguration->isEnabled())
setError(QString());
m_batchEditButton->setEnabled(m_buildConfiguration->isEnabled());
m_addButton->setEnabled(m_buildConfiguration->isEnabled());
}); });
updateSelection(); updateSelection();
@@ -744,6 +784,11 @@ static bool isIos(const Kit *k)
|| deviceType == Ios::Constants::IOS_SIMULATOR_TYPE; || deviceType == Ios::Constants::IOS_SIMULATOR_TYPE;
} }
static bool isWebAssembly(const Kit *k)
{
return DeviceTypeKitAspect::deviceTypeId(k) == WebAssembly::Constants::WEBASSEMBLY_DEVICE_TYPE;
}
static QStringList defaultInitialCMakeArguments(const Kit *k, const QString buildType) static QStringList defaultInitialCMakeArguments(const Kit *k, const QString buildType)
{ {
// Generator: // Generator:
@@ -909,8 +954,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
const QString sysroot = deviceType == Ios::Constants::IOS_DEVICE_TYPE const QString sysroot = deviceType == Ios::Constants::IOS_DEVICE_TYPE
? QLatin1String("iphoneos") ? QLatin1String("iphoneos")
: QLatin1String("iphonesimulator"); : QLatin1String("iphonesimulator");
initialArgs.append("-DCMAKE_TOOLCHAIN_FILE:PATH=%{Qt:QT_INSTALL_PREFIX}/lib/cmake/" initialArgs.append(CMAKE_QT6_TOOLCHAIN_FILE_ARG);
"Qt6/qt.toolchain.cmake");
initialArgs.append("-DCMAKE_OSX_ARCHITECTURES:STRING=" + architecture); initialArgs.append("-DCMAKE_OSX_ARCHITECTURES:STRING=" + architecture);
initialArgs.append("-DCMAKE_OSX_SYSROOT:STRING=" + sysroot); initialArgs.append("-DCMAKE_OSX_SYSROOT:STRING=" + sysroot);
initialArgs.append("%{" + QLatin1String(DEVELOPMENT_TEAM_FLAG) + "}"); initialArgs.append("%{" + QLatin1String(DEVELOPMENT_TEAM_FLAG) + "}");
@@ -918,6 +962,12 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
} }
} }
if (isWebAssembly(k)) {
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
if (qt && qt->qtVersion().majorVersion >= 6)
initialArgs.append(CMAKE_QT6_TOOLCHAIN_FILE_ARG);
}
if (info.buildDirectory.isEmpty()) { if (info.buildDirectory.isEmpty()) {
setBuildDirectory(shadowBuildDirectory(target->project()->projectFilePath(), setBuildDirectory(shadowBuildDirectory(target->project()->projectFilePath(),
k, k,

View File

@@ -541,13 +541,18 @@ void CMakeBuildSystem::clearCMakeCache()
stopParsingAndClearState(); stopParsingAndClearState();
const FilePath cmakeCache = m_parameters.workDirectory / "CMakeCache.txt"; const QList<FilePath> pathsToDelete = {
const FilePath cmakeFiles = m_parameters.workDirectory / "CMakeFiles"; m_parameters.workDirectory / "CMakeCache.txt",
m_parameters.workDirectory / "CMakeCache.txt.prev",
m_parameters.workDirectory / "CMakeFiles",
m_parameters.workDirectory / ".cmake/api/v1/reply",
m_parameters.workDirectory / ".cmake/api/v1/reply.prev"
};
if (cmakeCache.exists()) for (const FilePath &path : pathsToDelete) {
Utils::FileUtils::removeRecursively(cmakeCache); if (path.exists())
if (cmakeFiles.exists()) Utils::FileUtils::removeRecursively(path);
Utils::FileUtils::removeRecursively(cmakeFiles); }
} }
std::unique_ptr<CMakeProjectNode> CMakeBuildSystem::generateProjectTree( std::unique_ptr<CMakeProjectNode> CMakeBuildSystem::generateProjectTree(

View File

@@ -35,6 +35,8 @@ namespace Internal {
class CMakeProjectImporter : public QtSupport::QtProjectImporter class CMakeProjectImporter : public QtSupport::QtProjectImporter
{ {
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeProjectImporter)
public: public:
CMakeProjectImporter(const Utils::FilePath &path); CMakeProjectImporter(const Utils::FilePath &path);

View File

@@ -33,6 +33,7 @@ static const char SETTINGS_KEY[] = "CMakeSpecificSettings";
static const char AFTER_ADD_FILE_ACTION_KEY[] = "ProjectPopupSetting"; static const char AFTER_ADD_FILE_ACTION_KEY[] = "ProjectPopupSetting";
static const char NINJA_PATH[] = "NinjaPath"; static const char NINJA_PATH[] = "NinjaPath";
static const char PACKAGE_MANAGER_AUTO_SETUP[] = "PackageManagerAutoSetup"; static const char PACKAGE_MANAGER_AUTO_SETUP[] = "PackageManagerAutoSetup";
static const char ASK_RECONFIGURE_INITIAL_PARAMS[] = "AskReConfigureInitialParams";
} }
void CMakeSpecificSettings::fromSettings(QSettings *settings) void CMakeSpecificSettings::fromSettings(QSettings *settings)
@@ -53,6 +54,7 @@ void CMakeSpecificSettings::toSettings(QSettings *settings) const
settings->beginGroup(QString(SETTINGS_KEY)); settings->beginGroup(QString(SETTINGS_KEY));
settings->setValue(QString(AFTER_ADD_FILE_ACTION_KEY), static_cast<int>(m_afterAddFileToProjectSetting)); settings->setValue(QString(AFTER_ADD_FILE_ACTION_KEY), static_cast<int>(m_afterAddFileToProjectSetting));
settings->setValue(QString(PACKAGE_MANAGER_AUTO_SETUP), m_packageManagerAutoSetup); settings->setValue(QString(PACKAGE_MANAGER_AUTO_SETUP), m_packageManagerAutoSetup);
settings->setValue(QString(ASK_RECONFIGURE_INITIAL_PARAMS), m_askBeforeReConfigureInitialParams);
settings->endGroup(); settings->endGroup();
} }
} }

View File

@@ -53,10 +53,13 @@ public:
void setPackageManagerAutoSetup(bool checked) { m_packageManagerAutoSetup = checked; } void setPackageManagerAutoSetup(bool checked) { m_packageManagerAutoSetup = checked; }
bool packageManagerAutoSetup() const { return m_packageManagerAutoSetup; } bool packageManagerAutoSetup() const { return m_packageManagerAutoSetup; }
bool askBeforeReConfigureInitialParams() const { return m_askBeforeReConfigureInitialParams; }
void setAskBeforeReConfigureInitialParams(bool doAsk) { m_askBeforeReConfigureInitialParams = doAsk; }
private: private:
AfterAddFileAction m_afterAddFileToProjectSetting; AfterAddFileAction m_afterAddFileToProjectSetting;
Utils::FilePath m_ninjaPath; Utils::FilePath m_ninjaPath;
bool m_packageManagerAutoSetup = true; bool m_packageManagerAutoSetup = true;
bool m_askBeforeReConfigureInitialParams = true;
}; };
} }

View File

@@ -72,6 +72,7 @@ CMakeSpecificSettingWidget::CMakeSpecificSettingWidget(CMakeSpecificSettings *se
} }
m_ui.packageManagerAutoSetup->setChecked(settings->packageManagerAutoSetup()); m_ui.packageManagerAutoSetup->setChecked(settings->packageManagerAutoSetup());
m_ui.askBeforeReConfigureWithInitialParams->setChecked(settings->askBeforeReConfigureInitialParams());
} }
void CMakeSpecificSettingWidget::apply() void CMakeSpecificSettingWidget::apply()
@@ -80,6 +81,7 @@ void CMakeSpecificSettingWidget::apply()
m_settings->setAfterAddFileSetting(popupSetting == -1 ? AfterAddFileAction::ASK_USER m_settings->setAfterAddFileSetting(popupSetting == -1 ? AfterAddFileAction::ASK_USER
: static_cast<AfterAddFileAction>(popupSetting)); : static_cast<AfterAddFileAction>(popupSetting));
m_settings->setPackageManagerAutoSetup(m_ui.packageManagerAutoSetup->isChecked()); m_settings->setPackageManagerAutoSetup(m_ui.packageManagerAutoSetup->isChecked());
m_settings->setAskBeforeReConfigureInitialParams(m_ui.askBeforeReConfigureWithInitialParams->isChecked());
m_settings->toSettings(Core::ICore::settings()); m_settings->toSettings(Core::ICore::settings());
} }

View File

@@ -70,6 +70,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="askBeforeReConfigureWithInitialParams">
<property name="text">
<string>Ask before re-configuring with initial parameters</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@@ -896,7 +896,21 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri
return QString::compare(cfg.name, cmakeBuildType, Qt::CaseInsensitive) == 0; return QString::compare(cfg.name, cmakeBuildType, Qt::CaseInsensitive) == 0;
}); });
if (it == codeModels.cend()) { if (it == codeModels.cend()) {
errorMessage = QString("No '%1' CMake configuration found!").arg(cmakeBuildType); QStringList buildTypes;
for (const Configuration &cfg: codeModels)
buildTypes << cfg.name;
if (result.replyFile.isMultiConfig) {
errorMessage = tr("No \"%1\" CMake configuration found. Available configurations: \"%2\".\n"
"Make sure that CMAKE_CONFIGURATION_TYPES variable contains the \"Build type\" field.")
.arg(cmakeBuildType)
.arg(buildTypes.join(", "));
} else {
errorMessage = tr("No \"%1\" CMake configuration found. Available configuration: \"%2\".\n"
"Make sure that CMAKE_BUILD_TYPE variable matches the \"Build type\" field.")
.arg(cmakeBuildType)
.arg(buildTypes.join(", "));
}
qWarning() << errorMessage; qWarning() << errorMessage;
return result; return result;
} }

View File

@@ -245,6 +245,7 @@ public:
class FileApiParser class FileApiParser
{ {
Q_DECLARE_TR_FUNCTIONS(FileApiParser)
public: public:
static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType, static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType,
QString &errorMessage); QString &errorMessage);

View File

@@ -125,11 +125,12 @@ static const char preferredEditorFactoriesKey[] = "EditorManager/PreferredEditor
static const char scratchBufferKey[] = "_q_emScratchBuffer"; static const char scratchBufferKey[] = "_q_emScratchBuffer";
// for lupdate
using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
using namespace Utils; using namespace Utils;
namespace Core {
//===================EditorManager===================== //===================EditorManager=====================
/*! /*!
@@ -3876,5 +3877,3 @@ void CorePlugin::testSplitLineAndColumnNumber_data()
} }
#endif // WITH_TESTS #endif // WITH_TESTS
} // namespace Core

View File

@@ -8530,7 +8530,7 @@ public:
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) { switch (section) {
case 0: case 0:
return tr("Base Class Constructors"); return CppQuickFixFactory::tr("Base Class Constructors");
} }
} }
return {}; return {};

View File

@@ -177,13 +177,13 @@ class Filter : public Core::SearchResultFilter
const auto widget = new QWidget; const auto widget = new QWidget;
const auto layout = new QVBoxLayout(widget); const auto layout = new QVBoxLayout(widget);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
const auto readsCheckBox = new QCheckBox(tr("Reads")); const auto readsCheckBox = new QCheckBox(CppFindReferences::tr("Reads"));
readsCheckBox->setChecked(m_showReads); readsCheckBox->setChecked(m_showReads);
const auto writesCheckBox = new QCheckBox(tr("Writes")); const auto writesCheckBox = new QCheckBox(CppFindReferences::tr("Writes"));
writesCheckBox->setChecked(m_showWrites); writesCheckBox->setChecked(m_showWrites);
const auto declsCheckBox = new QCheckBox(tr("Declarations")); const auto declsCheckBox = new QCheckBox(CppFindReferences::tr("Declarations"));
declsCheckBox->setChecked(m_showDecls); declsCheckBox->setChecked(m_showDecls);
const auto otherCheckBox = new QCheckBox(tr("Other")); const auto otherCheckBox = new QCheckBox(CppFindReferences::tr("Other"));
otherCheckBox->setChecked(m_showOther); otherCheckBox->setChecked(m_showOther);
layout->addWidget(readsCheckBox); layout->addWidget(readsCheckBox);
layout->addWidget(writesCheckBox); layout->addWidget(writesCheckBox);

View File

@@ -193,7 +193,7 @@ LanguageClientSettingsPageWidget::LanguageClientSettingsPageWidget(LanguageClien
auto addMenu = new QMenu; auto addMenu = new QMenu;
addMenu->clear(); addMenu->clear();
for (const ClientType &type : clientTypes()) { for (const ClientType &type : clientTypes()) {
auto action = new QAction(tr("New %1").arg(type.name)); auto action = new QAction(LanguageClientSettingsPage::tr("New %1").arg(type.name));
connect(action, &QAction::triggered, this, [this, id = type.id]() { addItem(id); }); connect(action, &QAction::triggered, this, [this, id = type.id]() { addItem(id); });
addMenu->addAction(action); addMenu->addAction(action);
} }

Some files were not shown because too many files have changed in this diff Show More