Merge "Merge remote-tracking branch 'origin/4.13' into master"

This commit is contained in:
The Qt Project
2020-09-03 10:18:31 +00:00
82 changed files with 4830 additions and 1429 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -100,7 +100,7 @@
\li GCC, Clang \li GCC, Clang
\li LLDB, FSF GDB (experimental) \li LLDB, FSF GDB (experimental)
\row \row
\li Windows/MinGW \li Windows/\MinGW
\li GCC \li GCC
\li GDB \li GDB
\row \row
@@ -173,7 +173,7 @@
\section2 GDB \section2 GDB
On Windows, use the Python-enabled GDB version that is bundled On Windows, use the Python-enabled GDB version that is bundled
with the Qt package or comes with recent versions of MinGW. On with the Qt package or comes with recent versions of \MinGW. On
most Linux distributions, the GDB builds shipped with the system most Linux distributions, the GDB builds shipped with the system
are sufficient. are sufficient.

View File

@@ -136,7 +136,7 @@
In general, \key F5 and the \uicontrol {Start Debugging of Startup Project} In general, \key F5 and the \uicontrol {Start Debugging of Startup Project}
button are set up in a button are set up in a
way to start the operating mode that is commonly used in a given context. So way to start the operating mode that is commonly used in a given context. So
if the current project is set up as a C++ application using the MinGW if the current project is set up as a C++ application using the \MinGW
toolchain targeting desktop Windows, the GDB engine will be started in Start toolchain targeting desktop Windows, the GDB engine will be started in Start
Internal mode. If the current project is a QML application using C++ Internal mode. If the current project is a QML application using C++
plugins, a "mixed" QML/C++ engine will be started, with the C++ parts being plugins, a "mixed" QML/C++ engine will be started, with the C++ parts being

View File

@@ -46,7 +46,7 @@
For more information about where the files are located on each supported For more information about where the files are located on each supported
platform, see \l {Location of Settings Files}. platform, see \l {Location of Settings Files}.
\b {\QC comes with MinGW, should I use this version with Qt?} \b {\QC comes with \MinGW, should I use this version with Qt?}
Use the version that was built against the Qt version. Use the version that was built against the Qt version.

View File

@@ -57,9 +57,9 @@
\li GNU Compiler Collection (GCC) is a compiler for Linux and \li GNU Compiler Collection (GCC) is a compiler for Linux and
\macos. \macos.
\li MinGW (Minimalist GNU for Windows) is a native software port of GCC \li \MinGW (Minimalist GNU for Windows) is a native software port of GCC
and GNU Binutils for use in the development of native Microsoft and GNU Binutils for use in the development of native Microsoft
Windows applications on Windows. MinGW is Windows applications on Windows. \MinGW is
distributed together with \QC and Qt installers for Windows. distributed together with \QC and Qt installers for Windows.
\li ICC (Intel C++ Compiler) is a group of C and C++ compilers. \li ICC (Intel C++ Compiler) is a group of C and C++ compilers.
@@ -114,7 +114,7 @@
\section1 Specifying Compiler Settings \section1 Specifying Compiler Settings
To build an application using GCC, MinGW, Clang, or QCC, specify the path To build an application using GCC, \MinGW, Clang, or QCC, specify the path
to the directory where the compiler is located and select to the directory where the compiler is located and select
the application binary interface (ABI) version from the list of available the application binary interface (ABI) version from the list of available
versions. You can also create a custom ABI definition. versions. You can also create a custom ABI definition.
@@ -215,7 +215,7 @@
see \l{Using Custom Output Parsers}. see \l{Using Custom Output Parsers}.
\endlist \endlist
\section1 Troubleshooting MinGW Compilation Errors \section1 Troubleshooting \MinGW Compilation Errors
If error messages displayed in the \uicontrol {Compile Output} pane contain If error messages displayed in the \uicontrol {Compile Output} pane contain
paths where slashes are missing (for example, \c {C:QtSDK}), paths where slashes are missing (for example, \c {C:QtSDK}),
@@ -228,7 +228,7 @@
\endcode \endcode
If these commands show paths, they have been added to the global PATH If these commands show paths, they have been added to the global PATH
variable during the installation of a tool chain based on Cygwin or MinGW, variable during the installation of a tool chain based on Cygwin or \MinGW,
even though this is against Windows conventions. even though this is against Windows conventions.
To keep working with the third-party tool chain, create a new shell link To keep working with the third-party tool chain, create a new shell link

View File

@@ -136,7 +136,10 @@
\li \l{Adding Models} \li \l{Adding 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{Applying 3D Effects} \li \l{Applying 3D Effects}
\li \l{Using Custom Shaders}
\li \l{Creating Custom Effects and Materials}
\li \l{Using Lights} \li \l{Using Lights}
\li \l{Using Scene Camera} \li \l{Using Scene Camera}
\li \l{Setting Scene Environment} \li \l{Setting Scene Environment}

View File

@@ -60,9 +60,9 @@
\uicontrol Properties view. \uicontrol Properties view.
\li Drag and drop a \uicontrol Rectangle from the \uicontrol Library to \li Drag and drop a \uicontrol Rectangle from the \uicontrol Library to
the item in the navigator. This creates a nested item where the the item in \uicontrol Navigator. This creates a nested item where
item is the parent of the rectangle. Items are positioned relative the item is the parent of the rectangle. Items are positioned
to their parents. relative to their parents.
\li In the \uicontrol Properties view, modify the appearance of the \li In the \uicontrol Properties view, modify the appearance of the
rectangle: rectangle:
@@ -71,8 +71,8 @@
\li In the \uicontrol Color field, select the button color. \li In the \uicontrol Color field, select the button color.
\li In the \uicontrol Radius field, use the slider to set the radius of \li In the \uicontrol Radius field, set the radius of
the rectangle and produce rounded corners for the button. the rectangle to produce rounded corners for the button.
\li Select \uicontrol {Layout}, and then select the \li Select \uicontrol {Layout}, and then select the
\inlineimage anchor-fill.png \inlineimage anchor-fill.png
@@ -82,14 +82,15 @@
\endlist \endlist
\li Drag and drop a \uicontrol {Text} type to the item in the navigator. \li Drag and drop a \uicontrol {Text} type to the item in
\uicontrol Navigator.
\li In the \uicontrol Properties view, edit the properties of the \uicontrol Text \li In the \uicontrol Properties view, edit the properties of the \uicontrol Text
type. type.
\list a \list a
\li In the \uicontrol Text field, type \b Button. \li In the \uicontrol Text field, enter \e Button.
You can select the text color in the \uicontrol {Text color} field and the You can select the text color in the \uicontrol {Text color} field and the
font, size, and style in the font, size, and style in the
@@ -109,10 +110,17 @@
\endlist \endlist
To be useful, the button type has to be created in a project.
When you work on other QML files in the project to create screens
or other components for the UI, the button type appears in the
\uicontrol {My QML Components} tab of the \uicontrol Library view.
You can use it to create button instances and modify their properties
to assign them useful IDs, change their appearance, and set the button
text for each button instance, for example.
To create a graphical button that scales beautifully without using vector To create a graphical button that scales beautifully without using vector
graphics, use the \l [QML]{BorderImage}{Border Image} type. For more graphics, use the \l [QML]{BorderImage}{Border Image} type. For more
information, see \l{Creating Scalable Buttons and Borders}. information, see \l{Creating Scalable Buttons and Borders}.
*/ */
@@ -126,166 +134,147 @@
You can use the \l [QML]{BorderImage}{Border Image} type to display an You can use the \l [QML]{BorderImage}{Border Image} type to display an
image, such as a PNG file, as a border and a background. image, such as a PNG file, as a border and a background.
Use two border images and suitable graphics to make it look like the Use two border images and suitable graphics to change the appearance of
button is pushed down when it is clicked. One of the border images a button when it is clicked. You can use use \l{Adding States}{states}
is visible by default. You can specify that it is hidden and the other one to determine which image is visible depending on whether the mouse
becomes visible when the mouse is clicked. button is pressed down. You could add more images and states to
change the appearance of the button depending on other mouse events,
such as hovered.
Add a \l [QML]{MouseArea}{Mouse Area} type that covers the whole area and Add a \l [QML]{MouseArea}{Mouse Area} type that covers the whole area and
emits the clicked signal (\c {item.clicked()}) when it detects a mouse reacts to mouse events.
click.
You can add text to the button and set it up as a property. The text can You can use states also to change the button text color and font size. For
then be initialized from the outside, making the button a reusable UI example, you can scale the button text up or down.
component. The font size is also available in case the default size is too
big. You can scale down the button text and use smooth text rendering for
some extra quality.
\image qmldesigner-borderimage.png "Graphical button" \image qmldesigner-borderimage-type.png "Button type in Form Editor and States"
To create a graphical button: \section1 Creating the Button Type
\list 1 To create a button type, select \uicontrol File >
\uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New File or Project} >
\if defined(qtcreator) \if defined(qtcreator)
\uicontrol Qt > \uicontrol {QML File (Qt Quick 2)} > \uicontrol Qt > \uicontrol {QML File (Qt Quick 2)} >
\else \else
\uicontrol {Qt Quick Files} > \uicontrol {Qt Quick File} > \uicontrol {Qt Quick Files} > \uicontrol {Qt Quick File} >
\endif \endif
\uicontrol Choose to create a QML file called Button.qml (for \uicontrol Choose to create a QML file called Button.qml (for example).
example).
\note Types are listed in the \uicontrol Library only if the \note Types are listed in the \uicontrol Library only if the
filename begins with a capital letter. filename begins with a capital letter.
\li Click \uicontrol {Design} to edit the file in the \section1 Constructing the Button Component
To construct the button component:
\list 1
\li Click \uicontrol {Design} to edit the QML file in the
\uicontrol {Form Editor}. \uicontrol {Form Editor}.
\li In the \uicontrol {Assets} tab of \uicontrol Library, select
\li In the \uicontrol Navigator, select \uicontrol Item and set the \uicontrol {Add New Assets} to copy the image files you want
to use to the project folder.
\li In the \uicontrol Navigator, select the root item and set the
width (\uicontrol W) and height (\uicontrol H) of the button in the width (\uicontrol W) and height (\uicontrol H) of the button in the
\uicontrol Properties view. \uicontrol Properties view to match the size of the images
you plan to use. This specifies the initial size of the button
\li Select \uicontrol Connections > \uicontrol {Properties} > component.
\uicontrol Add to add properties for the item: \li Drag and drop two \uicontrol {Border Image} types from
\uicontrol Library to the root item in \uicontrol Navigator.
\image qmldesigner-borderimage-properties.png "Properties" \li Drag and drop a \uicontrol Text type to the root item.
\li Drag and drop a \uicontrol {Mouse Area} to the root item in
\uicontrol Navigator.
\li Select a border image to edit the values of its properties:
\list a \list a
\li In the \uicontrol Id field, enter an ID for the border
\li Double-click in the columns in the view to specify a \c text image. In this example, we use the ID \e inactiveButton.
property with the type \c string and an empty value. \li In the \uicontrol Source field, select the image file for
the border image. For example, inactive_button.png.
\li Specify another property, \c fontSize, with the type \c int \li In the \uicontrol {Layout} tab, select the
and the value \c 10.
\endlist
\li Drag and drop two \uicontrol {Border Image} types from the
\uicontrol Library to the item in the \uicontrol Navigator.
\li Drag and drop a \uicontrol Text type to the item in the navigator.
\li Drag and drop a \uicontrol {Mouse Area} to the item in the
navigator.
\li In the navigator, select a border image to specify settings for it
in the \uicontrol Properties view:
\list a
\li Select \uicontrol Connections > \uicontrol {Bindings}
> \uicontrol Add to hide the image when the mouse button is not
pressed down. Specify the \c visible property with the
\c !mouseArea source item and \c pressed source property.
\image qmldesigner-borderimage-bindings.png "Border image bindings"
\li In the \uicontrol Source field, select the image file for the button,
for example button_up.png.
\li Click \uicontrol {Layout}, and then click the
\inlineimage anchor-fill.png \inlineimage anchor-fill.png
(\uicontrol {Fill to Parent}) button to anchor the border image to the (\uicontrol {Fill to Parent}) button to always make the
\uicontrol Item. image the same size as its parent. This makes the button
component scalable, because the image size is bound to the
component size.
\endlist \endlist
\li Select the other border image to edit the values of its properties
\li Select the other border image to specify similar settings for it: similarly:
\list a \list a
\li In the \uicontrol Id field, enter \e activeButton.
\li In \uicontrol Bindings, specify the \c visible property \li In the \uicontrol Source field, select the image file
with the \c mouseArea source item and \c pressed source for the button when it is clicked. For example,
property to show the image when the mouse button is pressed active_button.png.
down. \li In the \uicontrol {Layout} tab, select the
\inlineimage anchor-fill.png
\li In the \uicontrol Source field, select the image file for the button (\uicontrol {Fill to Parent}) button.
when it is clicked, for example button_down.png.
\li Select \uicontrol {Layout} > \uicontrol {Fill to Parent}
button to anchor the border image to the \uicontrol Item.
\endlist \endlist
\li Select the text item to specify font size and color in
\li Select the text to specify font size and color, and text scaling \uicontrol Properties:
and rendering:
\list a \list a
\li In the \uicontrol Color field, use
\li In the \uicontrol Color field, use the color picker to select the color picker to select the font color, or enter a value
the font color, or enter a value in the field. in the field.
\li In \uicontrol Font group, \uicontrol Size field, enter the
\li In \uicontrol Bindings, create bindings to properties: font size.
\li In the \uicontrol {Layout} tab, select
\image qmldesigner-borderimage-bindings-text.png "Text bindings"
\list
\li Set the source property of the \c text property as
\c text and the source item as \c parent.
\li Set the source property of the \c font.pixelSize as
\c fontSize and the source item as \c parent.
\li Set the source property of \c scale as
\c {if (!mouseArea} and the source item as
\c {pressed) { 1 } else { 0.95 }}.
\endlist
\li Click \uicontrol {Layout}, and then click the
\inlineimage anchor-vertical-center.png \inlineimage anchor-vertical-center.png
(\uicontrol {Vertical Center}) and (\uicontrol {Vertical Center}) and
\inlineimage anchor-horizontal-center.png \inlineimage anchor-horizontal-center.png
(\uicontrol {Horizontal Center}) buttons to inherit the (\uicontrol {Horizontal Center}) buttons to inherit the
vertical and horizontal centering from the parent. vertical and horizontal centering from the parent.
This ensures that the button label is centered when the
component is resized.
\endlist
\endlist \endlist
\li Select \uicontrol mouseArea in the navigator and then select \section1 Using States to Change Component Property Values
\uicontrol Connections > \uicontrol Add to set \c item.clicked()
as the value of the \c onClicked signal handler.
\image qmldesigner-borderimage-connections.png "Item connections"
\li In the \uicontrol {Text Editor}, specify the \c clicked signal for
the Item:
\qml
Item {
id: item
property string text: ""
property int fontSize: 10
signal clicked
}
\endqml
\list 1
\li In the \uicontrol States view, select \inlineimage plus.png
twice to create two new states.
\image qmldesigner-borderimage-states.png "Active and inactive states"
\li Select \uicontrol State1.
\li Change the state name to \e active.
\li Select \inlineimage icons/action-icon.png
, and then select \uicontrol {Set when Condition} to determine
when the state should be applied.
\li In the \uicontrol {Binding Editor}, select the \c mouseArea
type and the \c pressed signal to specify that the state is
applied when the mouse button is pressed down.
\image qmldesigner-borderimage-bindings.png "Active state when condition"
\li Select the text item in \uicontrol Navigator to specify that the
text size is scaled up when the button is pressed down.
\li In \uicontrol Properties, select the \uicontrol Advanced tab, and
increase the value of the \uicontrol Scale property.
\li Select \e inactiveButton in \uicontrol Navigator to hide
it in the \e active state by changing the value of its
\uicontrol Visibility property in \uicontrol Properties.
\li Select \uicontrol State2.
\li Change the state name to \e inactive.
\li Set the when condition for the state to \c !mouseArea.pressed to
specify that the state is applied when the mouse button is not
pressed down.
\image qmldesigner-borderimage-bindings1.png "Inactive state when condition"
it in the \e inactive state by changing the value of its
\uicontrol Visibility property in \uicontrol Properties.
\li Press \key {Ctrl+S} to save the button.
\li Select the \inlineimage live_preview.png
(\uicontrol {Show Live Preview}) button to check how the
button behaves when you click it. You can drag the preview
window borders to see what happens when you resize the
component.
\endlist \endlist
\note To test the button, add it to a Qt Quick Application or Qt To be useful, the button type has to be created in a project.
Quick UI project and run the application. When you work on other QML files in the project to create screens
or other components for the UI, the button type appears in the
\uicontrol {My QML Components} tab of the \uicontrol Library view.
You can drag and drop it to \uicontrol {Form Editor} or
\uicontrol Navigator to create button instances and modify the values
of their properties to assign them useful IDs, change their appearance,
and set the button text for each button instance, for example.
For more information about positioning buttons on screens, see
\l{Positioning Items in UIs}.
\image qmldesigner-borderimage.png "Button preview as part of a screen"
*/ */

View File

@@ -52,7 +52,7 @@
\list \list
\li Qt for WebAssembly 5.13.1, or later \li Qt for WebAssembly 5.13.1, or later
\li On Windows: \l{http://wiki.qt.io/MinGW}{MinGW} 7.3.0, or later \li On Windows: \l{http://wiki.qt.io/MinGW}{\MinGW} 7.3.0, or later
\li \l{https://emscripten.org/docs/introducing_emscripten/index.html} \li \l{https://emscripten.org/docs/introducing_emscripten/index.html}
{emscripten} tool chain for compiling to WebAssembly {emscripten} tool chain for compiling to WebAssembly
\li \c sed stream editor \li \c sed stream editor

View File

@@ -137,7 +137,7 @@
The \QC that is included in pre-built Qt packages on Windows is built with The \QC that is included in pre-built Qt packages on Windows is built with
the Microsoft Visual Studio compiler, whereas the version of Qt shipped for the Microsoft Visual Studio compiler, whereas the version of Qt shipped for
building applications is configured and built to use the MinGW/g++ compiler. building applications is configured and built to use the \MinGW/g++ compiler.
Plugins built by using this version of Qt cannot be loaded by \QC because Plugins built by using this version of Qt cannot be loaded by \QC because
the build-keys do not match. The plugins can only be used in the standalone the build-keys do not match. The plugins can only be used in the standalone
version of \QD. Choose \uicontrol Help > \uicontrol {About \QC} to check the version of \QD. Choose \uicontrol Help > \uicontrol {About \QC} to check the
@@ -145,7 +145,7 @@
To use \QD plugins that were built for the shipped Qt version, make sure To use \QD plugins that were built for the shipped Qt version, make sure
that \QC is built with the same compiler by either recompiling \QC using that \QC is built with the same compiler by either recompiling \QC using
MinGW or recompiling Qt with Microsoft Visual Studio, depending on which \MinGW or recompiling Qt with Microsoft Visual Studio, depending on which
configuration you want to use for your applications. configuration you want to use for your applications.
*/ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -46,30 +46,40 @@
that you don't want to be part of the final UI, to avoid cluttering that you don't want to be part of the final UI, to avoid cluttering
the \QDS project. The QML code generated in \QDS corresponds to the the \QDS project. The QML code generated in \QDS corresponds to the
structure of your Sketch document. structure of your Sketch document.
\li \QBSK supports document \e symbols and \e {symbol overrides}. Each \li \QBSK supports document \e symbols and \e {symbol overrides} for
symbol is exported as a QML component, and each symbol instance is text symbols. Each symbol is exported as a QML component, and each
generated as a respective \e component instance in the generated symbol instance is generated as a respective \e component instance
QML. The symbol overrides are exported as values of properties for in the generated QML. The symbol overrides are exported as values of
the components. For example, if you use symbol overrides to specify properties for the components. For example, if you use symbol
the text for each button instance, it is exported as a value of the overrides to specify the text for each button instance, it is
text property. exported as a value of the text property.
\li Create components in Sketch and export them to \QDS before you
start making instances of them. In \QDS, add functionality to the
components, such as button states and then bring them back to Sketch
as assets. If you use functional QML components in Sketch, you will
find it easier to merge new iterations of the design to \QDS and
continue to build the screens there.
\li Use descriptive and unique ids to avoid duplicate QML ids after
exporting assets and \l{Importing 2D Assets}{importing} them to
\QDS.
\li Store all assets in the scalable vector graphics (SVG) format \li Store all assets in the scalable vector graphics (SVG) format
to be able to easily rescale them for different screen sizes to be able to easily rescale them for different screen sizes
and resolutions. You can export assets into JPG, PNG, or SVG format and resolutions. You can export assets into JPG, PNG, or SVG format
and select options for optimizing them during the export. and select options for optimizing them during the export.
\endlist \endlist
To use the fonts that you use in Sketch also in \QDS, you need to load To use the fonts that you use in Sketch also in \QDS, you need to import
them to \QDS. \QDS deploys them to devices when you preview the UI. For more them to \QDS as assets. \QDS deploys them to devices when you preview the
information, see \l{Using Custom Fonts}. UI. For more information, see \l{Using Custom Fonts}.
For more information, watch videos about using \QBSK: For more information, see the \QBSK tutorials that are also accessible from
the \uicontrol Tutorials tab of the Welcome mode:
\list \list
\li \l{https://youtu.be/oLdEJMoE7l8} \li \l{https://www.qt.io/blog/qt-design-studio-sketch-bridge-tutorial-part-1}
{Webinar: Turn your Sketch UI Designs Into Code with Qt Design Studio} {Sketch Bridge Tutorial Part 1}
\li \l{https://youtu.be/qQM2oEWRBOw} \li \l{https://www.qt.io/blog/qt-design-studio-sketch-bridge-tutorial-part-2}
{Talk: Turn Sketch or Photoshop UI designs into working prototypes} {Sketch Bridge Tutorial Part 2}
\endlist \endlist
\section2 Using Artboards \section2 Using Artboards
@@ -94,6 +104,9 @@
import them as QML files and images that you can drag and drop to the import them as QML files and images that you can drag and drop to the
\uicontrol {Form Editor} in \QDS Design mode while creating a UI. \uicontrol {Form Editor} in \QDS Design mode while creating a UI.
If you want to use the assets on an artboard in \QDS as they are in Sketch,
you can import the artboard without generating QML code for it.
\section2 Using Layers and Groups \section2 Using Layers and Groups
When you use \QBSK to export your designs, you will determine how you want When you use \QBSK to export your designs, you will determine how you want
@@ -105,6 +118,21 @@
You can select the asset format and DPI to use for each image in You can select the asset format and DPI to use for each image in
\uicontrol Settings > \uicontrol {Asset Settings}. \uicontrol Settings > \uicontrol {Asset Settings}.
\section2 Using QML Ids
The most common issues in using \QBSK are caused by having duplicate ids in
your project. Even though the importer in \QDS is capable of detecting and
retaining QML ids, you should still manually check all the QML ids to make
them unique and descriptive.
Name the layers in exactly the same way as your QML ids, to be able to find
artwork later, especially as the export files can grow very large and
complicated as they approach the level of a complete UI project.
\note Even though \QDS is capable of handling the ids during merges, we
recommend that you do not change the ids after the first time you export
the assets, to avoid problems.
\section1 Exporting Assets \section1 Exporting Assets
By default, assets are exported as follows: By default, assets are exported as follows:
@@ -143,9 +171,9 @@
\list 1 \list 1
\li \QBSK automatically proposes identifiers for all groups and layers \li \QBSK automatically proposes identifiers for all groups and layers
that you can change in the \uicontrol {QML ID} field. The ids will that you can change in the \uicontrol {QML ID} field. Use unique and
be made unique when the layer and the respective artwork is imported descriptive ids to avoid duplicate QML ids when the layer and the
into \QDS. respective artwork is imported into \QDS.
\li In the \uicontrol {Export As} field, select the export type for the \li In the \uicontrol {Export As} field, select the export type for the
group or layer: group or layer:
\list \list

View File

@@ -38,7 +38,7 @@
\QDS is available in binary packages for the following operating systems: \QDS is available in binary packages for the following operating systems:
\list \list
\li \macos 10.13 and 10.14.x \li \macOS 10.13 and 10.14.x
\li Ubuntu Linux 18.04 \li Ubuntu Linux 18.04
\li Windows 10 \li Windows 10
\endlist \endlist

View File

@@ -108,6 +108,8 @@
\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{Applying 3D Effects} \li \l{Applying 3D Effects}
\li \l{Using Custom Shaders}
\li \l{Creating Custom Effects and Materials}
\li \l{Using Lights} \li \l{Using Lights}
\li \l{Using Scene Camera} \li \l{Using Scene Camera}
\li \l{Setting Scene Environment} \li \l{Setting Scene Environment}

View File

@@ -58,10 +58,26 @@
You can use a Texture component to specify an image and how it is You can use a Texture component to specify an image and how it is
mapped to meshes in a 3D scene. Texture components can use image mapped to meshes in a 3D scene. Texture components can use image
data either from a file or a Qt Quick QML type. data either from a file or a Qt Quick QML type.
\li \l {Using 3D Materials}
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
effects. effects.
\li \l {Using Custom Shaders}
You can use 3D shader utilities to construct your own effects and
materials.
\li \l{Creating Custom Effects and Materials}
If the ready-made 3D effects and materials don't meet your needs,
you can use 3D shader utilities to construct your own effects and
materials.
\li \l{Using Lights} \li \l{Using Lights}
You can use several light types as the source of lighting in a You can use several light types as the source of lighting in a

View File

@@ -0,0 +1,163 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Design Studio.
**
** $QT_BEGIN_LICENSE:FDL$
** 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.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page studio-3d-custom-effects-materials.html
\previouspage studio-3d-custom-shaders.html
\nextpage studio-3d-lights.html
\title Creating Custom Effects and Materials
You can use the QML types in the \uicontrol {Qt Quick 3D Custom Shader Utils}
tab of \uicontrol Library to create custom effects and materials. To make
the \uicontrol Effect and \uicontrol {Custom Material} types appear in the
tab, you must select \uicontrol {Add Import} in the \uicontrol {QML Imports}
tab, and then select \uicontrol QtQuick3D.Effects and
\uicontrol QtQuick3D.Materials to import the QML types in the
\l{Qt Quick 3D Effects QML Types}{Qt Quick 3D Effects} and
\l{Qt Quick 3D Materials QML Types}{Qt Quick 3D Materials} modules to your
project. These modules contain a set of ready-made effects and materials
that you can apply to 3D models.
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"
\note You must create the actual shader source files with some other tool
and copy them to your project folder. You can then specify the source file
names in the custom effect or material properties.
\section1 Creating Custom Effects
By default, a custom effect component contains a Pass type and a Shader
type in the fragment stage. You can add passes, shaders, and other shader
utilities to the effect.
\image studio-qtquick-3d-custom-effect-navigator.png "Custom effect in Navigator"
The fragment shader component is created with a placeholder for the path
to the shader file. Specify the path to the shader file to use in the
shader properties.
To create a custom effect:
\list 1
\li Drag and drop an \uicontrol {Effect} type from the
\uicontrol {Qt Quick 3D Custom Shader Utils} tab of
\uicontrol Library to a Model component in \uicontrol Navigator.
\li Select the custom effect component in \uicontrol Navigator to edit
the values of its properties in the \uicontrol Properties view.
\image studio-qtquick-3d-custom-effect.png "Custom effect properties"
\li In the \uicontrol Passes field, select the pass components for
the effect.
\li Select the pass component in \uicontrol Navigator to specify values
for its properties in \uicontrol Properties.
\image studio-qtquick-3d-pass.png "Pass properties"
\li To execute commands during the pass, drag and drop the following
command types from \uicontrol Library to the custom material in
\uicontrol Navigator: \uicontrol Blending, \uicontrol {Buffer Blit},
\uicontrol {Buffer Input}, \uicontrol {Cull Mode},
\uicontrol {Depth Input}, \uicontrol {Render State}, and
\uicontrol {Set Uniform Value}. Then select the commands in the
\uicontrol Commands field.
\li To allocate a buffer for the pass, drag and drop a \uicontrol Buffer
type to the custom material. Then select the buffer in the
\uicontrol Buffer field.
\li Select the shader component in \uicontrol Navigator to set the path
to the shader files in the \uicontrol Source field in
\uicontrol Properties.
\image studio-qtquick-3d-shader-properties.png "Shader properties"
\endlist
\section1 Creating Custom Materials
By default, a Custom Material component contains two Shader types, a Shader
Info type, and a Pass type. You can add shaders, passes, and other shader
utilities to the material.
\image studio-qtquick-3d-custom-material-navigator.png "Custom material in Navigator"
By default, fragment and vertex shaders are created with placeholders for
the paths to the shader files. Specify the paths to the shader files to use
in the shader properties.
The Shader Info type specifies the shader type and version, as well
as the options used by the shader based on the selected shader key values,
such as diffuse or specular lighting, refraction, transparency, displacement,
transmissiveness, glossiness, and alpha cutout.
The shaders are used with the Pass type to create the resulting material.
A pass can contain multiple rendering passes and other commands. You can
use a Buffer type to allocate a buffer for storing intermediate rendering
results.
To create a custom material:
\list 1
\li Drag and drop a \uicontrol {Custom Material} type from the
\uicontrol {Qt Quick 3D Custom Shader Utils} tab of
\uicontrol Library to a Model component in \uicontrol Navigator.
\li Select the custom material component in \uicontrol Navigator to
edit the values of its properties in the \uicontrol Properties view.
\image studio-qtquick-3d-custom-material.png "Custom material properties"
\li Select the \uicontrol Transparency check box to make the material
transparent.
\li Select the \uicontrol Refraction check box to specify that the
material is \l{Using Highlights and Reflections}{reflective}.
\li Select the \uicontrol {Always dirty} check box to determine that
the material needs to be refreshed every time it is used.
\li In the \uicontrol {Shader Info} field, select the shader info
type to use.
\li In the \uicontrol Passes field, select the pass components for
the effect.
\li In the \uicontrol Material group, select the
\l{Using Highlights and Reflections}{light probe},
\l{Simulating Geometry Displacement}{displacement map and amount},
and \l{Culling Faces}{culling mode} to use.
\li Select the shader info component in \uicontrol Navigator to specify
values for its properties in \uicontrol Properties.
\image studio-qtquick-3d-shader-info.png "Shader Info properties"
\li Select the pass component in \uicontrol Navigator to specify values
for its properties in \uicontrol Properties.
\image studio-qtquick-3d-pass.png "Pass properties"
\li To execute commands during the pass, drag and drop the following
command types from \uicontrol Library to the custom material in
\uicontrol Navigator: \uicontrol Blending, \uicontrol {Buffer Blit},
\uicontrol {Buffer Input}, \uicontrol {Cull Mode},
\uicontrol {Depth Input}, \uicontrol {Render State}, and
\uicontrol {Set Uniform Value}. Then select the commands in the
\uicontrol Commands field.
\li To allocate a buffer for the pass, drag and drop a \uicontrol Buffer
type to the custom material. Then select the buffer in the
\uicontrol Buffer field.
\li Select the shader components in \uicontrol Navigator to set the
paths to the shader files in the \uicontrol Source field in
\uicontrol Properties.
\image studio-qtquick-3d-shader-properties.png "Shader properties"
\endlist
*/

View File

@@ -0,0 +1,190 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Design Studio.
**
** $QT_BEGIN_LICENSE:FDL$
** 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.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page studio-3d-custom-shaders.html
\previouspage studio-3d-effects.html
\nextpage studio-3d-custom-effects-materials.html
\title Using Custom Shaders
You can use the Qt Quick 3D shader utilities and commands to create your own
effects and materials.
For more information on using the shaders, see
\l {Creating Custom Effects and Materials}.
See the following tables for available shader utilities and commands.
\section1 Available Custom Shader Utilities
\table
\header
\li Custom Shader
\li Description
\row
\li \l Buffer
\li A buffer to be used for a pass of a Custom Material or an Effect.
Specify attributes for the buffer by defining the \uicontrol Name
and \uicontrol Format and \uicontrol {Allocation Flags} properties.
The \uicontrol Filter property specifies the filter operation when a
render pass is reading the buffer that differs in size in comparison
to the current output buffer.
The \uicontrol {Coordinate Operation} property specifies the texture
coordinate operation for coordinates outside [0, 1] range.
You can also specify the \uicontrol {Size Multiplier} of the buffer.
Value of 1.0 creates buffer with the same size while 0.5 creates
buffer with width and height halved.
\row
\li \l {CustomMaterial} {Custom Material}
\li The base component for creating custom materials used to shade
models.
Specify the attributes of the \uicontrol {Custom Material} by
defining the \uicontrol Transparency, \uicontrol Refraction and
\uicontrol {Always Dirty} properties. The \uicontrol Passes property
contains a list of render passes implemented by the material.
The \uicontrol {Shader Info} specifies the shader info of the
material. For more information, see \l {Creating Custom Effects and
Materials}.
\row
\li \l Effect
\li A base component for creating post-processing effects.
The \uicontrol Passes property contains a list of render passes
implemented by the effect. For more information, see
\l {Creating Custom Effects and Materials}.
\row
\li \l Pass
\li A render pass in a Custom Material or an Effect.
The \uicontrol Commands property specifies the list of render
commands of the pass. You can further define a render pass by using
the \uicontrol Buffer and \uicontrol Shaders properties.
\row
\li \l Shader
\li A container component for defining shader code used by Custom
Materials and Effects.
Define the \uicontrol Shader attributes by specifying the
\uicontrol Source and \uicontrol Stage properties.
\row
\li \l {ShaderInfo} {Shader Info}
\li Basic information about custom shader code for Custom Materials.
The \uicontrol Version property specifies the shader code version,
while the \uicontrol Type property defines the shader code type.
The \uicontrol Key property specifies the options used by the shader
using the combination of shader key values, such as diffuse or
specular lighting, refraction, transparency, displacement,
transmissiveness, glossiness, and alpha cutout.
\row
\li \l {TextureInput} {Texture Input}
\li A texture channel for a Custom Material or an Effect.
The \uicontrol Texture property specifies the texture to input, while
the \uicontrol Enabled determines whether the texture is enabled.
\endtable
\section1 Available Custom Shader Commands
\table
\header
\li Command
\li Description
\row
\li \l Blending
\li A pass command that specifies the source blending function.
Use the \uicontrol Source and \uicontrol Destination to further
define the function.
\row
\li \l {BufferBlit} {Buffer Blit}
\li A copy operation between two buffers in a pass of a Custom Material
or an Effect.
Define the source and the destination buffer of the copy-operation
by using the \uicontrol Source and \uicontrol Destination
properties.
\row
\li \l {BufferInput} {Buffer Input}
\li An input buffer to be used for a pass of a Custom Material or an
Effect.
The \uicontrol Buffer property specifies the buffer used for the
parameter. The \uicontrol Parameter specifies the name of the input
parameter in the shader.
\row
\li \l {CullMode} {Cull Mode}
\li A culling mode for a render pass.
The \uicontrol Mode specifies the culling mode in a pass when the
\uicontrol {State} property of the \uicontrol {Render State} is
set to \uicontrol CullFace.
\row
\li \l {DepthInput} {Depth Input}
\li An output texture for the depth buffer.
The \uicontrol Parameter property specifies the name of the texture
the depth buffer will bind to.
\row
\li \l {RenderState} {Render State}
\li The render state to be enabled or disabled in a pass of a Custom
Material or an Effect.
The \uicontrol State property specifies the render state to
enable or disable in a pass.
\row
\li \l {SetUniformValue} {Set Uniform Value}
\li A value to be set during a single pass.
The \uicontrol Target property specifies the name of the uniform
that will have its value changed during the pass, while the
\uicontrol Value specifies the value that will be set on the target
uniform.
\endtable
*/

View File

@@ -28,7 +28,7 @@
/*! /*!
\page studio-3d-effects.html \page studio-3d-effects.html
\previouspage studio-3d-texture.html \previouspage studio-3d-texture.html
\nextpage studio-3d-lights.html \nextpage studio-3d-custom-shaders.html
\title Applying 3D Effects \title Applying 3D Effects
@@ -44,6 +44,9 @@
See the following table for available effects and example images. See the following table for available effects and example images.
For more information about creating your own effects, see
\l {Creating Custom Effects and Materials}.
\section1 Available Effects \section1 Available Effects
\table \table
\header \header

View File

@@ -27,7 +27,7 @@
/*! /*!
\page studio-3d-lights.html \page studio-3d-lights.html
\previouspage studio-3d-effects.html \previouspage studio-3d-custom-effects-materials.html
\nextpage studio-3d-camera.html \nextpage studio-3d-camera.html
\title Using Lights \title Using Lights

View File

@@ -3,7 +3,7 @@
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Desing Studio. ** This file is part of Qt Design Studio.
** **
** $QT_BEGIN_LICENSE:FDL$ ** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage ** Commercial License Usage
@@ -48,7 +48,7 @@
\list \list
\li Default material \li Default material
\li Principled material \li Principled material
\li Custom material \li \l{Creating Custom Effects and Materials}{Custom material}
\li Texture \li Texture
\endlist \endlist
@@ -56,8 +56,7 @@
material to define how the mesh is shaded. The DefaultMaterial component material to define how the mesh is shaded. The DefaultMaterial component
is the easiest way to define such a material. The PrincipledMaterial is the easiest way to define such a material. The PrincipledMaterial
component specifies the minimum amount of properties. The CustomMaterial component specifies the minimum amount of properties. The CustomMaterial
component enables you to access the Qt Quick 3D material library and component enables you to construct your own materials.
to implement your own materials.
You can use the \l Texture component to apply textures to materials. It You can use the \l Texture component to apply textures to materials. It
defines an image and how the image is mapped to meshes in a 3D scene. For defines an image and how the image is mapped to meshes in a 3D scene. For
@@ -219,30 +218,6 @@
is not rendered. Culling makes rendering objects quicker and more efficient is not rendered. Culling makes rendering objects quicker and more efficient
by reducing the number of polygons to draw. by reducing the number of polygons to draw.
\section1 Creating Custom Materials
The material uses a Shader component to specify shader source and shader
stage. These are used with the \uicontrol passes property to create the
resulting material. The passes can contain multiple rendering passes and
also other commands.
Normally, only the fragment shader needs to be specified as a value for
the \uicontrol passes property. The material library generates the vertex
shader for the material. The material can also create buffers to store
intermediate rendering results.
The \uicontrol shaderInfo property specifies settings for the shader.
To specify that the material state is always dirty, which indicates that
the material needs to be refreshed every time it is used, select the
\uicontrol alwaysDirty check box.
To specify that the material has refraction, select the
\uicontrol hasRefraction check box.
To specify that the material has transparency, select the
\uicontrol hasTransparency check box.
\section1 Applying Materials to Models \section1 Applying Materials to Models
To apply materials to models: To apply materials to models:

View File

@@ -56,10 +56,19 @@ from dumper import DumperBase, SubItem, Children, TopLevelItem
####################################################################### #######################################################################
qqWatchpointOffset = 10000 qqWatchpointOffset = 10000
_c_str_trans = None
if sys.version_info[0] >= 3:
_c_str_trans = str.maketrans({"\n": "\\n", '"':'\\"', "\\":"\\\\"})
def toCString(s):
if _c_str_trans is not None:
return str(s).translate(_c_str_trans)
else:
return str(s).replace('\\', '\\\\').replace('\n', '\\n').replace('"', '\\"')
def fileNameAsString(file): def fileNameAsString(file):
return str(file) if file.IsValid() else '' return toCString(file) if file.IsValid() else ''
def check(exp): def check(exp):
@@ -755,9 +764,9 @@ class Dumper(DumperBase):
self.debugger.GetCommandInterpreter().HandleCommand(command, result) self.debugger.GetCommandInterpreter().HandleCommand(command, result)
success = result.Succeeded() success = result.Succeeded()
if success: if success:
self.report('output="%s"' % result.GetOutput()) self.report('output="%s"' % toCString(result.GetOutput()))
else: else:
self.report('error="%s"' % result.GetError()) self.report('error="%s"' % toCString(result.GetError()))
def canonicalTypeName(self, name): def canonicalTypeName(self, name):
return re.sub('\\bconst\\b', '', name).replace(' ', '') return re.sub('\\bconst\\b', '', name).replace(' ', '')
@@ -921,7 +930,7 @@ class Dumper(DumperBase):
state = 1 if self.target.IsValid() else 0 state = 1 if self.target.IsValid() else 0
self.reportResult('success="%s",msg="%s",exe="%s"' self.reportResult('success="%s",msg="%s",exe="%s"'
% (state, error, self.executable_), args) % (state, toCString(error), toCString(self.executable_)), args)
def runEngine(self, args): def runEngine(self, args):
""" Set up SBProcess instance """ """ Set up SBProcess instance """
@@ -1033,16 +1042,16 @@ class Dumper(DumperBase):
def describeError(self, error): def describeError(self, error):
desc = lldb.SBStream() desc = lldb.SBStream()
error.GetDescription(desc) error.GetDescription(desc)
result = 'success="%s",' % int(error.Success()) result = 'success="%d",' % int(error.Success())
result += 'error={type="%s"' % error.GetType() result += 'error={type="%s"' % error.GetType()
if error.GetType(): if error.GetType():
result += ',status="%s"' % error.GetCString() result += ',status="%s"' % error.GetCString()
result += ',code="%s"' % error.GetError() result += ',code="%s"' % error.GetError()
result += ',desc="%s"}' % desc.GetData() result += ',desc="%s"}' % toCString(desc.GetData())
return result return result
def describeStatus(self, status): def describeStatus(self, status):
return 'status="%s",' % status return 'status="%s",' % toCString(status)
def describeLocation(self, frame): def describeLocation(self, frame):
if int(frame.pc) == 0xffffffffffffffff: if int(frame.pc) == 0xffffffffffffffff:
@@ -1085,10 +1094,10 @@ class Dumper(DumperBase):
reason = thread.GetStopReason() reason = thread.GetStopReason()
result += '{id="%d"' % thread.GetThreadID() result += '{id="%d"' % thread.GetThreadID()
result += ',index="%s"' % i result += ',index="%s"' % i
result += ',details="%s"' % thread.GetQueueName() result += ',details="%s"' % toCString(thread.GetQueueName())
result += ',stop-reason="%s"' % self.stopReason(thread.GetStopReason()) result += ',stop-reason="%s"' % self.stopReason(thread.GetStopReason())
result += ',state="%s"' % state result += ',state="%s"' % state
result += ',name="%s"' % thread.GetName() result += ',name="%s"' % toCString(thread.GetName())
result += ',frame={' result += ',frame={'
frame = thread.GetFrameAtIndex(0) frame = thread.GetFrameAtIndex(0)
result += 'pc="0x%x"' % frame.pc result += 'pc="0x%x"' % frame.pc
@@ -1126,7 +1135,7 @@ class Dumper(DumperBase):
limit = args.get('stacklimit', -1) limit = args.get('stacklimit', -1)
(n, isLimited) = (limit, True) if limit > 0 else (thread.GetNumFrames(), False) (n, isLimited) = (limit, True) if limit > 0 else (thread.GetNumFrames(), False)
self.currentCallContext = None self.currentCallContext = None
result = 'stack={current-thread="%s"' % thread.GetThreadID() result = 'stack={current-thread="%d"' % thread.GetThreadID()
result += ',frames=[' result += ',frames=['
for i in range(n): for i in range(n):
frame = thread.GetFrameAtIndex(i) frame = thread.GetFrameAtIndex(i)
@@ -1148,7 +1157,7 @@ class Dumper(DumperBase):
interpreterStack = self.extractInterpreterStack() interpreterStack = self.extractInterpreterStack()
for interpreterFrame in interpreterStack.get('frames', []): for interpreterFrame in interpreterStack.get('frames', []):
function = interpreterFrame.get('function', '') function = interpreterFrame.get('function', '')
fileName = interpreterFrame.get('file', '') fileName = toCString(interpreterFrame.get('file', ''))
language = interpreterFrame.get('language', '') language = interpreterFrame.get('language', '')
lineNumber = interpreterFrame.get('line', 0) lineNumber = interpreterFrame.get('line', 0)
context = interpreterFrame.get('context', 0) context = interpreterFrame.get('context', 0)
@@ -1162,7 +1171,7 @@ class Dumper(DumperBase):
result += ',address="0x%x"' % addr result += ',address="0x%x"' % addr
result += ',function="%s"' % functionName result += ',function="%s"' % functionName
result += ',line="%d"' % lineNumber result += ',line="%d"' % lineNumber
result += ',module="%s"' % module result += ',module="%s"' % toCString(module)
result += ',file="%s"},' % fileName result += ',file="%s"},' % fileName
result += ']' result += ']'
result += ',hasmore="%d"' % isLimited result += ',hasmore="%d"' % isLimited
@@ -1202,7 +1211,7 @@ class Dumper(DumperBase):
return self.target.FindFirstGlobalVariable(symbolName) return self.target.FindFirstGlobalVariable(symbolName)
def warn(self, msg): def warn(self, msg):
self.put('{name="%s",value="",type="",numchild="0"},' % msg) self.put('{name="%s",value="",type="",numchild="0"},' % toCString(msg))
def fetchVariables(self, args): def fetchVariables(self, args):
(ok, res) = self.tryFetchInterpreterVariables(args) (ok, res) = self.tryFetchInterpreterVariables(args)
@@ -1314,15 +1323,15 @@ class Dumper(DumperBase):
interp.HandleCommand("register write %s %s" % (name, value), result) interp.HandleCommand("register write %s %s" % (name, value), result)
success = result.Succeeded() success = result.Succeeded()
if success: if success:
self.reportResult('output="%s"' % result.GetOutput(), args) self.reportResult('output="%s"' % toCString(result.GetOutput()), args)
return return
# Try again with register write xmm0 "{0x00 ... 0x02}" syntax: # Try again with register write xmm0 "{0x00 ... 0x02}" syntax:
vec = ' '.join(["0x" + value[i:i + 2] for i in range(2, len(value), 2)]) vec = ' '.join(["0x" + value[i:i + 2] for i in range(2, len(value), 2)])
success = interp.HandleCommand('register write %s "{%s}"' % (name, vec), result) success = interp.HandleCommand('register write %s "{%s}"' % (name, vec), result)
if success: if success:
self.reportResult('output="%s"' % result.GetOutput(), args) self.reportResult('output="%s"' % toCString(result.GetOutput()), args)
else: else:
self.reportResult('error="%s"' % result.GetError(), args) self.reportResult('error="%s"' % toCString(result.GetError()), args)
def report(self, stuff): def report(self, stuff):
with self.outputLock: with self.outputLock:
@@ -1386,14 +1395,16 @@ class Dumper(DumperBase):
skipEventReporting = eventType in ( skipEventReporting = eventType in (
lldb.SBProcess.eBroadcastBitSTDOUT, lldb.SBProcess.eBroadcastBitSTDERR) lldb.SBProcess.eBroadcastBitSTDOUT, lldb.SBProcess.eBroadcastBitSTDERR)
self.report('event={type="%s",data="%s",msg="%s",flavor="%s",state="%s",bp="%s"}' self.report('event={type="%s",data="%s",msg="%s",flavor="%s",state="%s",bp="%s"}'
% (eventType, out.GetData(), msg, flavor, self.stateName(state), bp)) % (eventType, toCString(out.GetData()),
toCString(msg), flavor, self.stateName(state), bp))
if state == lldb.eStateExited: if state == lldb.eStateExited:
self.eventState = state self.eventState = state
if not self.isShuttingDown_: if not self.isShuttingDown_:
self.reportState("inferiorexited") self.reportState("inferiorexited")
self.report('exited={status="%s",desc="%s"}' self.report('exited={status="%d",desc="%s"}'
% (self.process.GetExitStatus(), self.process.GetExitDescription())) % (self.process.GetExitStatus(),
toCString(self.process.GetExitDescription())))
elif state != self.eventState and not skipEventReporting: elif state != self.eventState and not skipEventReporting:
self.eventState = state self.eventState = state
if state == lldb.eStateStopped: if state == lldb.eStateStopped:
@@ -1457,17 +1468,17 @@ class Dumper(DumperBase):
result = 'lldbid="%s"' % (qqWatchpointOffset + bp.GetID()) result = 'lldbid="%s"' % (qqWatchpointOffset + bp.GetID())
else: else:
result = 'lldbid="%s"' % bp.GetID() result = 'lldbid="%s"' % bp.GetID()
result += ',valid="%s"' % (1 if bp.IsValid() else 0) result += ',valid="%d"' % (1 if bp.IsValid() else 0)
result += ',hitcount="%s"' % bp.GetHitCount() result += ',hitcount="%d"' % bp.GetHitCount()
if bp.IsValid(): if bp.IsValid():
if isinstance(bp, lldb.SBBreakpoint): if isinstance(bp, lldb.SBBreakpoint):
result += ',threadid="%s"' % bp.GetThreadID() result += ',threadid="%d"' % bp.GetThreadID()
result += ',oneshot="%s"' % (1 if bp.IsOneShot() else 0) result += ',oneshot="%d"' % (1 if bp.IsOneShot() else 0)
cond = bp.GetCondition() cond = bp.GetCondition()
result += ',condition="%s"' % self.hexencode("" if cond is None else cond) result += ',condition="%s"' % self.hexencode("" if cond is None else cond)
result += ',enabled="%s"' % (1 if bp.IsEnabled() else 0) result += ',enabled="%d"' % (1 if bp.IsEnabled() else 0)
result += ',valid="%s"' % (1 if bp.IsValid() else 0) result += ',valid="%d"' % (1 if bp.IsValid() else 0)
result += ',ignorecount="%s"' % bp.GetIgnoreCount() result += ',ignorecount="%d"' % bp.GetIgnoreCount()
if bp.IsValid() and isinstance(bp, lldb.SBBreakpoint): if bp.IsValid() and isinstance(bp, lldb.SBBreakpoint):
result += ',locations=[' result += ',locations=['
lineEntry = None lineEntry = None
@@ -1475,19 +1486,19 @@ class Dumper(DumperBase):
loc = bp.GetLocationAtIndex(i) loc = bp.GetLocationAtIndex(i)
addr = loc.GetAddress() addr = loc.GetAddress()
lineEntry = addr.GetLineEntry() lineEntry = addr.GetLineEntry()
result += '{locid="%s"' % loc.GetID() result += '{locid="%d"' % loc.GetID()
result += ',function="%s"' % addr.GetFunction().GetName() result += ',function="%s"' % addr.GetFunction().GetName()
result += ',enabled="%s"' % (1 if loc.IsEnabled() else 0) result += ',enabled="%d"' % (1 if loc.IsEnabled() else 0)
result += ',resolved="%s"' % (1 if loc.IsResolved() else 0) result += ',resolved="%d"' % (1 if loc.IsResolved() else 0)
result += ',valid="%s"' % (1 if loc.IsValid() else 0) result += ',valid="%d"' % (1 if loc.IsValid() else 0)
result += ',ignorecount="%s"' % loc.GetIgnoreCount() result += ',ignorecount="%d"' % loc.GetIgnoreCount()
result += ',file="%s"' % lineEntry.GetFileSpec() result += ',file="%s"' % toCString(lineEntry.GetFileSpec())
result += ',line="%s"' % lineEntry.GetLine() result += ',line="%d"' % lineEntry.GetLine()
result += ',addr="%s"},' % addr.GetFileAddress() result += ',addr="%s"},' % addr.GetFileAddress()
result += ']' result += ']'
if lineEntry is not None: if lineEntry is not None:
result += ',file="%s"' % lineEntry.GetFileSpec() result += ',file="%s"' % toCString(lineEntry.GetFileSpec())
result += ',line="%s"' % lineEntry.GetLine() result += ',line="%d"' % lineEntry.GetLine()
return result return result
def createBreakpointAtMain(self): def createBreakpointAtMain(self):
@@ -1590,7 +1601,7 @@ class Dumper(DumperBase):
loc.SetEnabled(bool(args['enabled'])) loc.SetEnabled(bool(args['enabled']))
enabled = loc.IsEnabled() enabled = loc.IsEnabled()
res = True res = True
self.reportResult('success="%s",enabled="%s",locid="%s"' self.reportResult('success="%d",enabled="%d",locid="%d"'
% (int(res), int(enabled), locId), args) % (int(res), int(enabled), locId), args)
def removeBreakpoint(self, args): def removeBreakpoint(self, args):
@@ -1598,21 +1609,21 @@ class Dumper(DumperBase):
if lldbId > qqWatchpointOffset: if lldbId > qqWatchpointOffset:
res = self.target.DeleteWatchpoint(lldbId - qqWatchpointOffset) res = self.target.DeleteWatchpoint(lldbId - qqWatchpointOffset)
res = self.target.BreakpointDelete(lldbId) res = self.target.BreakpointDelete(lldbId)
self.reportResult('success="%s"' % int(res), args) self.reportResult('success="%d"' % int(res), args)
def fetchModules(self, args): def fetchModules(self, args):
result = 'modules=[' result = 'modules=['
for i in range(self.target.GetNumModules()): for i in range(self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(i) module = self.target.GetModuleAtIndex(i)
result += '{file="%s"' % module.file.fullpath result += '{file="%s"' % toCString(module.file.fullpath)
result += ',name="%s"' % module.file.basename result += ',name="%s"' % toCString(module.file.basename)
result += ',addrsize="%s"' % module.addr_size result += ',addrsize="%d"' % module.addr_size
result += ',triple="%s"' % module.triple result += ',triple="%s"' % module.triple
#result += ',sections={' #result += ',sections={'
#for section in module.sections: #for section in module.sections:
# result += '[name="%s"' % section.name # result += '[name="%s"' % section.name
# result += ',addr="%s"' % section.addr # result += ',addr="%s"' % section.addr
# result += ',size="%s"],' % section.size # result += ',size="%d"],' % section.size
#result += '}' #result += '}'
result += '},' result += '},'
result += ']' result += ']'
@@ -1636,7 +1647,7 @@ class Dumper(DumperBase):
result += ',name="%s"' % symbol.GetName() result += ',name="%s"' % symbol.GetName()
result += ',address="0x%x"' % startAddress result += ',address="0x%x"' % startAddress
result += ',demangled="%s"' % symbol.GetMangledName() result += ',demangled="%s"' % symbol.GetMangledName()
result += ',size="%s"' % (endAddress - startAddress) result += ',size="%d"' % (endAddress - startAddress)
result += '},' result += '},'
result += ']}' result += ']}'
self.reportResult(result, args) self.reportResult(result, args)
@@ -1726,7 +1737,8 @@ class Dumper(DumperBase):
result = lldb.SBCommandReturnObject() result = lldb.SBCommandReturnObject()
self.debugger.GetCommandInterpreter().HandleCommand('break list', result) self.debugger.GetCommandInterpreter().HandleCommand('break list', result)
self.report('success="%d",output="%s",error="%s"' self.report('success="%d",output="%s",error="%s"'
% (result.Succeeded(), result.GetOutput(), result.GetError())) % (result.Succeeded(), toCString(result.GetOutput()),
toCString(result.GetError())))
def activateFrame(self, args): def activateFrame(self, args):
self.reportToken(args) self.reportToken(args)
@@ -1751,8 +1763,8 @@ class Dumper(DumperBase):
command = args['command'] command = args['command']
self.debugger.GetCommandInterpreter().HandleCommand(command, result) self.debugger.GetCommandInterpreter().HandleCommand(command, result)
success = result.Succeeded() success = result.Succeeded()
output = result.GetOutput() output = toCString(result.GetOutput())
error = str(result.GetError()) error = toCString(str(result.GetError()))
self.report('success="%d",output="%s",error="%s"' % (success, output, error)) self.report('success="%d",output="%s",error="%s"' % (success, output, error))
def executeRoundtrip(self, args): def executeRoundtrip(self, args):
@@ -1808,8 +1820,8 @@ class Dumper(DumperBase):
# with non-existent directories appear. # with non-existent directories appear.
self.warn('FILE: %s ERROR: %s' % (fileName, error)) self.warn('FILE: %s ERROR: %s' % (fileName, error))
source = '' source = ''
result += '{line="%s"' % lineNumber result += '{line="%d"' % lineNumber
result += ',file="%s"' % fileName result += ',file="%s"' % toCString(fileName)
if 0 < lineNumber and lineNumber <= len(source): if 0 < lineNumber and lineNumber <= len(source):
result += ',hexdata="%s"' % self.hexencode(source[lineNumber - 1]) result += ',hexdata="%s"' % self.hexencode(source[lineNumber - 1])
result += ',hunk="%s"}' % hunk result += ',hunk="%s"}' % hunk

View File

@@ -1425,9 +1425,9 @@ Module {
Property { name: "highlight"; type: "QDeclarativeComponent"; isPointer: true } Property { name: "highlight"; type: "QDeclarativeComponent"; isPointer: true }
Property { name: "highlightItem"; type: "QDeclarativeItem"; isReadonly: true; isPointer: true } Property { name: "highlightItem"; type: "QDeclarativeItem"; isReadonly: true; isPointer: true }
Property { name: "highlightFollowsCurrentItem"; type: "bool" } Property { name: "highlightFollowsCurrentItem"; type: "bool" }
Property { name: "highlightMoveSpeed"; type: "qreal" } Property { name: "highlightMoveVelocity"; type: "qreal" }
Property { name: "highlightMoveDuration"; type: "int" } Property { name: "highlightMoveDuration"; type: "int" }
Property { name: "highlightResizeSpeed"; type: "qreal" } Property { name: "highlightResizeVelocity"; type: "qreal" }
Property { name: "highlightResizeDuration"; type: "int" } Property { name: "highlightResizeDuration"; type: "int" }
Property { name: "preferredHighlightBegin"; type: "qreal" } Property { name: "preferredHighlightBegin"; type: "qreal" }
Property { name: "preferredHighlightEnd"; type: "qreal" } Property { name: "preferredHighlightEnd"; type: "qreal" }
@@ -1448,9 +1448,9 @@ Module {
Signal { name: "layoutDirectionChanged"; revision: 1 } Signal { name: "layoutDirectionChanged"; revision: 1 }
Signal { name: "currentIndexChanged" } Signal { name: "currentIndexChanged" }
Signal { name: "currentSectionChanged" } Signal { name: "currentSectionChanged" }
Signal { name: "highlightMoveSpeedChanged" } Signal { name: "highlightMoveVelocityChanged" }
Signal { name: "highlightMoveDurationChanged" } Signal { name: "highlightMoveDurationChanged" }
Signal { name: "highlightResizeSpeedChanged" } Signal { name: "highlightResizeVelocityChanged" }
Signal { name: "highlightResizeDurationChanged" } Signal { name: "highlightResizeDurationChanged" }
Signal { name: "highlightChanged" } Signal { name: "highlightChanged" }
Signal { name: "highlightItemChanged" } Signal { name: "highlightItemChanged" }

View File

@@ -26,13 +26,47 @@
#pragma once #pragma once
#include <QMetaType> #include <QMetaType>
#include <QVariant>
#include "imagecontainer.h" #include "imagecontainer.h"
#include <utils/smallstringio.h> #include <vector>
namespace QmlDesigner { namespace QmlDesigner {
template<typename Type>
QDataStream &operator<<(QDataStream &out, const std::vector<Type> &vector)
{
out << quint64(vector.size());
for (auto &&entry : vector)
out << entry;
return out;
}
template<typename Type>
QDataStream &operator>>(QDataStream &in, std::vector<Type> &vector)
{
vector.clear();
quint64 size;
in >> size;
vector.reserve(size);
for (quint64 i = 0; i < size; ++i) {
Type entry;
in >> entry;
vector.push_back(std::move(entry));
}
return in;
}
class CapturedDataCommand class CapturedDataCommand
{ {
public: public:

View File

@@ -230,11 +230,14 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId()); nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId());
} else if (!instanceContainer.componentPath().isEmpty()) { } else if (!instanceContainer.componentPath().isEmpty()) {
object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context()); object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context());
if (object == nullptr) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
if (object == nullptr) { if (object == nullptr) {
const QString errors = getErrorString(nodeInstanceServer->engine(), instanceContainer.componentPath()); const QString errors = getErrorString(nodeInstanceServer->engine(), instanceContainer.componentPath());
const QString message = QString("Component with path %1 could not be created.\n\n").arg(instanceContainer.componentPath()); const QString message = QString("Component with path %1 could not be created.\n\n").arg(instanceContainer.componentPath());
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId()); nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId());
} }
}
} else { } else {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context()); object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
if (object == nullptr) if (object == nullptr)

View File

@@ -197,22 +197,6 @@ Column {
} }
} }
Label {
text: qsTr("Move speed")
tooltip: qsTr("Move animation speed of the highlight delegate.")
}
SectionLayout {
SpinBox {
backendValue: backendValues.highlightMoveSpeed
minimumValue: 0
maximumValue: 1000
decimals: 0
}
ExpandingSpacer {
}
}
Label { Label {
text: qsTr("Preferred begin") text: qsTr("Preferred begin")
tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")

View File

@@ -70,12 +70,14 @@ Column {
Label { Label {
text: qsTr("Source size") text: qsTr("Source size")
disabledState: !backendValues.sourceSize.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: "W" text: "W"
width: 12 width: 12
disabledStateSoft: !backendValues.sourceSize_width.isAvailable
} }
SpinBox { SpinBox {
@@ -83,6 +85,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 8192 maximumValue: 8192
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -93,6 +96,7 @@ Column {
Label { Label {
text: "H" text: "H"
width: 12 width: 12
disabledStateSoft: !backendValues.sourceSize_height.isAvailable
} }
SpinBox { SpinBox {
@@ -100,6 +104,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 8192 maximumValue: 8192
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {

View File

@@ -46,6 +46,7 @@ Column {
Label { Label {
text: qsTr("Cache") text: qsTr("Cache")
tooltip: qsTr("Cache buffer") tooltip: qsTr("Cache buffer")
disabledState: !backendValues.cacheBuffer.isAvailable
} }
SectionLayout { SectionLayout {
@@ -54,6 +55,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -63,6 +65,7 @@ Column {
Label { Label {
text: qsTr("Navigation wraps") text: qsTr("Navigation wraps")
tooltip: qsTr("Whether the grid wraps key navigation.") tooltip: qsTr("Whether the grid wraps key navigation.")
disabledState: !backendValues.keyNavigationWraps.isAvailable
} }
SectionLayout { SectionLayout {
@@ -70,6 +73,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.keyNavigationWraps backendValue: backendValues.keyNavigationWraps
text: backendValues.keyNavigationWraps.valueToString text: backendValues.keyNavigationWraps.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -93,6 +97,7 @@ Column {
Label { Label {
text: qsTr("Layout direction") text: qsTr("Layout direction")
disabledState: !backendValues.layoutDirection.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -101,6 +106,7 @@ Column {
model: ["LeftToRight", "RightToLeft"] model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection backendValue: backendValues.layoutDirection
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -109,6 +115,7 @@ Column {
Label { Label {
text: qsTr("Snap mode") text: qsTr("Snap mode")
tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.") tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.")
disabledState: !backendValues.snapMode.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -117,6 +124,7 @@ Column {
model: ["NoSnap", "SnapToItem", "SnapOneItem"] model: ["NoSnap", "SnapToItem", "SnapOneItem"]
backendValue: backendValues.snapMode backendValue: backendValues.snapMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -151,6 +159,7 @@ Column {
Label { Label {
text: qsTr("Range") text: qsTr("Range")
tooltip: qsTr("Highlight range") tooltip: qsTr("Highlight range")
disabledState: !backendValues.highlightRangeMode.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -159,6 +168,7 @@ Column {
model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"] model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"]
backendValue: backendValues.highlightRangeMode backendValue: backendValues.highlightRangeMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -168,30 +178,34 @@ Column {
Label { Label {
text: qsTr("Move duration") text: qsTr("Move duration")
tooltip: qsTr("Move animation duration of the highlight delegate.") tooltip: qsTr("Move animation duration of the highlight delegate.")
disabledState: !backendValues.highlightMoveDuration.isAvailable
} }
SectionLayout { SectionLayout {
SpinBox { SpinBox {
backendValue: backendValues.highlightMoveDuration backendValue: backendValues.highlightMoveDuration
minimumValue: 0 minimumValue: -1
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
} }
Label { Label {
text: qsTr("Move speed") text: qsTr("Move velocity")
tooltip: qsTr("Move animation speed of the highlight delegate.") tooltip: qsTr("Move animation velocity of the highlight delegate.")
disabledState: !backendValues.highlightMoveVelocity.isAvailable
} }
SectionLayout { SectionLayout {
SpinBox { SpinBox {
backendValue: backendValues.highlightMoveSpeed backendValue: backendValues.highlightMoveVelocity
minimumValue: 0 minimumValue: -1
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -200,14 +214,34 @@ Column {
Label { Label {
text: qsTr("Resize duration") text: qsTr("Resize duration")
tooltip: qsTr("Resizes animation duration of the highlight delegate.") tooltip: qsTr("Resizes animation duration of the highlight delegate.")
disabledState: !backendValues.highlightResizeDuration.isAvailable
} }
SectionLayout { SectionLayout {
SpinBox { SpinBox {
backendValue: backendValues.highlightResizeDuration backendValue: backendValues.highlightResizeDuration
minimumValue: 0 minimumValue: -1
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Resize velocity")
tooltip: qsTr("Resize animation velocity of the highlight delegate.")
disabledState: !backendValues.highlightResizeVelocity.isAvailable
}
SectionLayout {
SpinBox {
backendValue: backendValues.highlightResizeVelocity
minimumValue: -1
maximumValue: 1000
decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -216,6 +250,7 @@ Column {
Label { Label {
text: qsTr("Preferred begin") text: qsTr("Preferred begin")
tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")
disabledState: !backendValues.preferredHighlightBegin.isAvailable
} }
SectionLayout { SectionLayout {
@@ -224,6 +259,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -232,6 +268,7 @@ Column {
Label { Label {
text: qsTr("Preferred end") text: qsTr("Preferred end")
tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.") tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.")
disabledState: !backendValues.preferredHighlightEnd.isAvailable
} }
SectionLayout { SectionLayout {
@@ -240,6 +277,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 1000 maximumValue: 1000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -248,6 +286,7 @@ Column {
Label { Label {
text: qsTr("Follows current") text: qsTr("Follows current")
tooltip: qsTr("Whether the highlight is managed by the view.") tooltip: qsTr("Whether the highlight is managed by the view.")
disabledState: !backendValues.highlightFollowsCurrentItem.isAvailable
} }
SectionLayout { SectionLayout {
@@ -255,6 +294,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.highlightFollowsCurrentItem backendValue: backendValues.highlightFollowsCurrentItem
text: backendValues.highlightFollowsCurrentItem.valueToString text: backendValues.highlightFollowsCurrentItem.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }

View File

@@ -40,6 +40,7 @@ Column {
Label { Label {
text: qsTr("Enabled") text: qsTr("Enabled")
tooltip: qsTr("Accepts mouse events.") tooltip: qsTr("Accepts mouse events.")
disabledState: !backendValues.enabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -47,6 +48,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.enabled backendValue: backendValues.enabled
text: backendValues.enabled.valueToString text: backendValues.enabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -56,6 +58,7 @@ Column {
Label { Label {
text: qsTr("Hover enabled") text: qsTr("Hover enabled")
tooltip: qsTr("Handles hover events.") tooltip: qsTr("Handles hover events.")
disabledState: !backendValues.hoverEnabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -63,6 +66,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.hoverEnabled backendValue: backendValues.hoverEnabled
text: backendValues.hoverEnabled.valueToString text: backendValues.hoverEnabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -72,6 +76,7 @@ Column {
Label { Label {
text: qsTr("Accepted buttons") text: qsTr("Accepted buttons")
tooltip: qsTr("Mouse buttons that the mouse area reacts to.") tooltip: qsTr("Mouse buttons that the mouse area reacts to.")
disabledState: !backendValues.acceptedButtons.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -80,6 +85,7 @@ Column {
model: ["LeftButton", "RightButton", "MiddleButton", "BackButton", "ForwardButton", "AllButtons"] model: ["LeftButton", "RightButton", "MiddleButton", "BackButton", "ForwardButton", "AllButtons"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Qt" scope: "Qt"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -104,6 +110,7 @@ Column {
Label { Label {
text: qsTr("Scroll gesture enabled") text: qsTr("Scroll gesture enabled")
tooltip: qsTr("Responds to scroll gestures from non-mouse devices.") tooltip: qsTr("Responds to scroll gestures from non-mouse devices.")
disabledState: !backendValues.scrollGestureEnabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -111,6 +118,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.scrollGestureEnabled backendValue: backendValues.scrollGestureEnabled
text: backendValues.scrollGestureEnabled.valueToString text: backendValues.scrollGestureEnabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -120,6 +128,7 @@ Column {
Label { Label {
text: qsTr("Cursor shape") text: qsTr("Cursor shape")
tooltip: qsTr("Cursor shape for this mouse area.") tooltip: qsTr("Cursor shape for this mouse area.")
disabledState: !backendValues.cursorShape.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -133,6 +142,7 @@ Column {
"DragMoveCursor", "DragLinkCursor"] "DragMoveCursor", "DragLinkCursor"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Qt" scope: "Qt"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -141,6 +151,7 @@ Column {
Label { Label {
text: qsTr("Prevent stealing") text: qsTr("Prevent stealing")
tooltip: qsTr("Stops mouse events from being stolen from this mouse area.") tooltip: qsTr("Stops mouse events from being stolen from this mouse area.")
disabledState: !backendValues.preventStealing.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -148,6 +159,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.preventStealing backendValue: backendValues.preventStealing
text: backendValues.preventStealing.valueToString text: backendValues.preventStealing.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -157,6 +169,7 @@ Column {
Label { Label {
text: qsTr("Propagate composed events") text: qsTr("Propagate composed events")
tooltip: qsTr("Automatically propagates composed mouse events to other mouse areas.") tooltip: qsTr("Automatically propagates composed mouse events to other mouse areas.")
disabledState: !backendValues.propagateComposedEvents.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -164,6 +177,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.propagateComposedEvents backendValue: backendValues.propagateComposedEvents
text: backendValues.propagateComposedEvents.valueToString text: backendValues.propagateComposedEvents.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -176,6 +190,7 @@ Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
caption: qsTr("Drag") caption: qsTr("Drag")
visible: backendValues.drag_target.isAvailable
SectionLayout { SectionLayout {
Label { Label {

View File

@@ -39,6 +39,7 @@ Column {
SectionLayout { SectionLayout {
Label { Label {
text: qsTr("Layout direction") text: qsTr("Layout direction")
disabledState: !backendValues.layoutDirection.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -47,6 +48,7 @@ Column {
backendValue: backendValues.layoutDirection backendValue: backendValues.layoutDirection
Layout.fillWidth: true Layout.fillWidth: true
scope: "Qt" scope: "Qt"
enabled: backendValue.isAvailable
} }
} }

View File

@@ -56,6 +56,7 @@ Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
caption: qsTr("Style Color") caption: qsTr("Style Color")
visible: backendValues.styleColor.isAvailable
ColorEditor { ColorEditor {
caption: qsTr("Style Color") caption: qsTr("Style Color")

View File

@@ -42,6 +42,7 @@ Section {
Label { Label {
text: qsTr("Flick direction") text: qsTr("Flick direction")
disabledState: !backendValues.flickableDirection.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -50,6 +51,7 @@ Section {
model: ["AutoFlickDirection", "AutoFlickIfNeeded", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"] model: ["AutoFlickDirection", "AutoFlickIfNeeded", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -58,6 +60,7 @@ Section {
Label { Label {
text: qsTr("Behavior") text: qsTr("Behavior")
tooltip: qsTr("Whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.") tooltip: qsTr("Whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.")
disabledState: !backendValues.boundsBehavior.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -66,6 +69,7 @@ Section {
model: ["StopAtBounds", "DragOverBounds", "OvershootBounds", "DragAndOvershootBounds"] model: ["StopAtBounds", "DragOverBounds", "OvershootBounds", "DragAndOvershootBounds"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -75,6 +79,7 @@ Section {
Label { Label {
text: qsTr("Movement") text: qsTr("Movement")
tooltip: qsTr("Whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.") tooltip: qsTr("Whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
disabledState: !backendValues.boundsMovement.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -83,6 +88,7 @@ Section {
model: ["FollowBoundsBehavior", "StopAtBounds"] model: ["FollowBoundsBehavior", "StopAtBounds"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -122,6 +128,7 @@ Section {
Label { Label {
text: qsTr("Deceleration") text: qsTr("Deceleration")
tooltip: qsTr("Flick deceleration.") tooltip: qsTr("Flick deceleration.")
disabledState: !backendValues.flickDeceleration.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -130,6 +137,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 8000 maximumValue: 8000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -138,6 +146,7 @@ Section {
Label { Label {
text: qsTr("Press delay") text: qsTr("Press delay")
tooltip: qsTr("Time to delay delivering a press to children of the Flickable in milliseconds.") tooltip: qsTr("Time to delay delivering a press to children of the Flickable in milliseconds.")
disabledState: !backendValues.pressDelay.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -146,6 +155,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 2000 maximumValue: 2000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -154,6 +164,7 @@ Section {
Label { Label {
text: qsTr("Pixel aligned") text: qsTr("Pixel aligned")
tooltip: qsTr("Sets the alignment of contentX and contentY to pixels (true) or subpixels (false).") tooltip: qsTr("Sets the alignment of contentX and contentY to pixels (true) or subpixels (false).")
disabledState: !backendValues.pixelAligned.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -161,6 +172,7 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.pixelAligned backendValue: backendValues.pixelAligned
text: backendValues.pixelAligned.valueToString text: backendValues.pixelAligned.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -171,6 +183,7 @@ Section {
tooltip: qsTr("If set to true, then when the mouse or touchpoint moves far enough to begin dragging\n" tooltip: qsTr("If set to true, then when the mouse or touchpoint moves far enough to begin dragging\n"
+ "the content, the content will jump, such that the content pixel which was under the\n" + "the content, the content will jump, such that the content pixel which was under the\n"
+ "cursor or touchpoint when pressed remains under that point.") + "cursor or touchpoint when pressed remains under that point.")
disabledState: !backendValues.synchronousDrag.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -178,6 +191,7 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.synchronousDrag backendValue: backendValues.synchronousDrag
text: backendValues.synchronousDrag.valueToString text: backendValues.synchronousDrag.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -265,12 +279,15 @@ Section {
Label { Label {
text: qsTr("Origin") text: qsTr("Origin")
disabledState: (!backendValues.originX.isAvailable
&& !backendValues.originY.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: "X" text: "X"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.originX.isAvailable
} }
SpinBox { SpinBox {
@@ -279,6 +296,7 @@ Section {
maximumValue: 8000 maximumValue: 8000
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -289,6 +307,7 @@ Section {
Label { Label {
text: "Y" text: "Y"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.originY.isAvailable
} }
SpinBox { SpinBox {
@@ -297,6 +316,7 @@ Section {
maximumValue: 8000 maximumValue: 8000
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -304,6 +324,10 @@ Section {
Label { Label {
text: qsTr("Margins") text: qsTr("Margins")
disabledState: (!backendValues.topMargin.isAvailable
&& !backendValues.bottomMargin.isAvailable
&& !backendValues.leftMargin.isAvailable
&& !backendValues.rightMargin.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -312,6 +336,7 @@ Section {
Label { Label {
text: "Top" text: "Top"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.topMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -321,6 +346,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -331,6 +357,7 @@ Section {
Label { Label {
text: "Bottom" text: "Bottom"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.bottomMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -340,6 +367,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -355,6 +383,7 @@ Section {
Label { Label {
text: "Left" text: "Left"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.leftMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -364,6 +393,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -374,6 +404,7 @@ Section {
Label { Label {
text: "Right" text: "Right"
width: root.labelWidth width: root.labelWidth
disabledStateSoft: !backendValues.rightMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -383,6 +414,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }

View File

@@ -153,12 +153,13 @@ Section {
italic: fontSection.italicStyle italic: fontSection.italicStyle
underline: fontSection.underlineStyle underline: fontSection.underlineStyle
strikeout: fontSection.strikeoutStyle strikeout: fontSection.strikeoutStyle
enabled: !styleComboBox.styleSet enabled: !styleNameComboBox.styleSet
} }
Label { Label {
text: qsTr("Font capitalization") text: qsTr("Font capitalization")
toolTip: qsTr("Capitalization for the text.") toolTip: qsTr("Capitalization for the text.")
disabledState: !getBackendValue("capitalization").isAvailable
} }
ComboBox { ComboBox {
@@ -166,6 +167,7 @@ Section {
backendValue: getBackendValue("capitalization") backendValue: getBackendValue("capitalization")
model: ["MixedCase", "AllUppercase", "AllLowercase", "SmallCaps", "Capitalize"] model: ["MixedCase", "AllUppercase", "AllLowercase", "SmallCaps", "Capitalize"]
scope: "Font" scope: "Font"
enabled: backendValue.isAvailable
} }
Label { Label {
@@ -178,38 +180,45 @@ Section {
backendValue: getBackendValue("weight") backendValue: getBackendValue("weight")
model: ["Normal", "Light", "ExtraLight", "Thin", "Medium", "DemiBold", "Bold", "ExtraBold", "Black"] model: ["Normal", "Light", "ExtraLight", "Thin", "Medium", "DemiBold", "Bold", "ExtraBold", "Black"]
scope: "Font" scope: "Font"
enabled: !styleComboBox.styleSet enabled: !styleNameComboBox.styleSet
} }
Label { Label {
text: qsTr("Style name") text: qsTr("Style name")
toolTip: qsTr("Font's style.") toolTip: qsTr("Font's style.")
disabledState: !styleNameComboBox.enabled
} }
ComboBox { ComboBox {
id: styleComboBox id: styleNameComboBox
property bool styleSet: backendValue.isInModel property bool styleSet: backendValue.isInModel
Layout.fillWidth: true Layout.fillWidth: true
backendValue: getBackendValue("styleName") backendValue: getBackendValue("styleName")
model: styleNamesForFamily(fontComboBox.familyName) model: styleNamesForFamily(fontComboBox.familyName)
valueType: ComboBox.String valueType: ComboBox.String
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showStyle visible: showStyle
text: qsTr("Style") text: qsTr("Style")
disabledState: !styleComboBox.enabled
} }
ComboBox { ComboBox {
id: styleComboBox
visible: showStyle visible: showStyle
Layout.fillWidth: true Layout.fillWidth: true
backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style
model: ["Normal", "Outline", "Raised", "Sunken"] model: ["Normal", "Outline", "Raised", "Sunken"]
scope: "Text" scope: "Text"
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Spacing") text: qsTr("Spacing")
disabledState: (!getBackendValue("wordSpacing").isAvailable &&
!getBackendValue("letterSpacing").isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -222,18 +231,19 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 60 Layout.minimumWidth: 60
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Word") text: qsTr("Word")
tooltip: qsTr("Word spacing for the font.") tooltip: qsTr("Word spacing for the font.")
width: 42 width: 42
disabledStateSoft: !getBackendValue("wordSpacing").isAvailable
} }
Item { Item {
width: 4 width: 4
height: 4 height: 4
} }
SpinBox { SpinBox {
maximumValue: 500 maximumValue: 500
minimumValue: -500 minimumValue: -500
@@ -242,17 +252,21 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 60 Layout.minimumWidth: 60
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Letter") text: qsTr("Letter")
tooltip: qsTr("Letter spacing for the font.") tooltip: qsTr("Letter spacing for the font.")
width: 42 width: 42
disabledStateSoft: !getBackendValue("letterSpacing").isAvailable
} }
} }
Label { Label {
visible: minorQtQuickVersion > 9 visible: minorQtQuickVersion > 9
text: qsTr("Performance") text: qsTr("Performance")
disabledState: (!getBackendValue("kerning").isAvailable &&
!getBackendValue("preferShaping").isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -264,6 +278,7 @@ Section {
backendValue: getBackendValue("kerning") backendValue: getBackendValue("kerning")
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " + tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
"improve performance when creating or changing the text, at the expense of some cosmetic features.") "improve performance when creating or changing the text, at the expense of some cosmetic features.")
enabled: backendValue.isAvailable
} }
CheckBox { CheckBox {
@@ -273,12 +288,14 @@ Section {
tooltip: qsTr("Sometimes, a font will apply complex rules to a set of characters in order to display them correctly.\n" + tooltip: qsTr("Sometimes, a font will apply complex rules to a set of characters in order to display them correctly.\n" +
"In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " + "In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " +
"Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.") "Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.")
enabled: backendValue.isAvailable
} }
} }
Label { Label {
text: qsTr("Hinting preference") text: qsTr("Hinting preference")
toolTip: qsTr("Preferred hinting on the text.") toolTip: qsTr("Preferred hinting on the text.")
disabledState: !getBackendValue("hintingPreference").isAvailable
} }
ComboBox { ComboBox {
@@ -286,6 +303,7 @@ Section {
backendValue: getBackendValue("hintingPreference") backendValue: getBackendValue("hintingPreference")
model: ["PreferDefaultHinting", "PreferNoHinting", "PreferVerticalHinting", "PreferFullHinting"] model: ["PreferDefaultHinting", "PreferNoHinting", "PreferVerticalHinting", "PreferFullHinting"]
scope: "Font" scope: "Font"
enabled: backendValue.isAvailable
} }
} }
} }

View File

@@ -37,6 +37,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleBold buttonIcon: StudioTheme.Constants.fontStyleBold
backendValue: bold backendValue: bold
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -45,6 +46,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleItalic buttonIcon: StudioTheme.Constants.fontStyleItalic
backendValue: italic backendValue: italic
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -53,6 +55,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleUnderline buttonIcon: StudioTheme.Constants.fontStyleUnderline
backendValue: underline backendValue: underline
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -61,5 +64,6 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleStrikethrough buttonIcon: StudioTheme.Constants.fontStyleStrikethrough
backendValue: strikeout backendValue: strikeout
enabled: backendValue.isAvailable
} }
} }

View File

@@ -37,7 +37,9 @@ Label {
property alias toolTip: toolTipArea.tooltip property alias toolTip: toolTipArea.tooltip
width: Math.max(Math.min(240, parent.width - 280), 50) width: Math.max(Math.min(240, parent.width - 280), 50)
color: label.disabledState ? StudioTheme.Values.themeDisabledTextColor : StudioTheme.Values.themeTextColor color: ((label.disabledState || label.disabledStateSoft)
? StudioTheme.Values.themeDisabledTextColor
: StudioTheme.Values.themeTextColor)
elide: Text.ElideRight elide: Text.ElideRight
@@ -50,7 +52,9 @@ Label {
leftPadding: label.disabledState ? 10 : 0 leftPadding: label.disabledState ? 10 : 0
rightPadding: label.disabledState ? 10 : 0 rightPadding: label.disabledState ? 10 : 0
//Label can be disabled fully (with [] and padding), or in a soft way: only with tooltip and color change.
property bool disabledState: false property bool disabledState: false
property bool disabledStateSoft: false
Text { Text {
text: "[" text: "["
@@ -68,6 +72,8 @@ Label {
ToolTipArea { ToolTipArea {
id: toolTipArea id: toolTipArea
anchors.fill: parent anchors.fill: parent
tooltip: label.disabledState ? qsTr("This property is not available in this configuration.") : label.text tooltip: ((label.disabledState || label.disabledStateSoft)
? qsTr("This property is not available in this configuration.")
: label.text)
} }
} }

View File

@@ -36,12 +36,14 @@ Section {
SectionLayout { SectionLayout {
Label { Label {
text: qsTr("Vertical") text: qsTr("Vertical")
disabledState: (!backendValues.topPadding.isAvailable && !backendValues.bottomPadding.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: qsTr("Top") text: qsTr("Top")
tooltip: qsTr("Padding between the content and the top edge of the item.") tooltip: qsTr("Padding between the content and the top edge of the item.")
width: 42 width: 42
disabledStateSoft: !backendValues.topPadding.isAvailable
} }
SpinBox { SpinBox {
maximumValue: 10000 maximumValue: 10000
@@ -50,6 +52,7 @@ Section {
decimals: 0 decimals: 0
backendValue: backendValues.topPadding backendValue: backendValues.topPadding
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -60,6 +63,7 @@ Section {
text: qsTr("Bottom") text: qsTr("Bottom")
tooltip: qsTr("Padding between the content and the bottom edge of the item.") tooltip: qsTr("Padding between the content and the bottom edge of the item.")
width: 42 width: 42
disabledStateSoft: !backendValues.bottomPadding.isAvailable
} }
SpinBox { SpinBox {
maximumValue: 10000 maximumValue: 10000
@@ -68,17 +72,20 @@ Section {
decimals: 0 decimals: 0
backendValue: backendValues.bottomPadding backendValue: backendValues.bottomPadding
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
} }
Label { Label {
text: qsTr("Horizontal") text: qsTr("Horizontal")
disabledState: (!backendValues.leftPadding.isAvailable && !backendValues.rightPadding.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: qsTr("Left") text: qsTr("Left")
tooltip: qsTr("Padding between the content and the left edge of the item.") tooltip: qsTr("Padding between the content and the left edge of the item.")
width: 42 width: 42
disabledStateSoft: !backendValues.leftPadding.isAvailable
} }
SpinBox { SpinBox {
maximumValue: 10000 maximumValue: 10000
@@ -87,6 +94,7 @@ Section {
decimals: 0 decimals: 0
backendValue: backendValues.leftPadding backendValue: backendValues.leftPadding
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -97,6 +105,7 @@ Section {
text: qsTr("Right") text: qsTr("Right")
tooltip: qsTr("Padding between the content and the right edge of the item.") tooltip: qsTr("Padding between the content and the right edge of the item.")
width: 42 width: 42
disabledStateSoft: !backendValues.rightPadding.isAvailable
} }
SpinBox { SpinBox {
maximumValue: 10000 maximumValue: 10000
@@ -105,12 +114,14 @@ Section {
decimals: 0 decimals: 0
backendValue: backendValues.rightPadding backendValue: backendValues.rightPadding
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
} }
Label { Label {
text: qsTr("Padding") text: qsTr("Padding")
tooltip: qsTr("Padding between the content and the edges of the items.") tooltip: qsTr("Padding between the content and the edges of the items.")
disabledState: !backendValues.padding.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
@@ -120,6 +131,7 @@ Section {
decimals: 0 decimals: 0
backendValue: backendValues.padding backendValue: backendValues.padding
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
} }
} }

View File

@@ -76,6 +76,7 @@ Section {
Label { Label {
visible: showVerticalAlignment visible: showVerticalAlignment
text: qsTr("Wrap mode") text: qsTr("Wrap mode")
disabledState: !backendValues.wrapMode.isAvailable
} }
ComboBox { ComboBox {
@@ -84,11 +85,13 @@ Section {
backendValue: backendValues.wrapMode backendValue: backendValues.wrapMode
scope: "Text" scope: "Text"
model: ["NoWrap", "WordWrap", "WrapAnywhere", "Wrap"] model: ["NoWrap", "WordWrap", "WrapAnywhere", "Wrap"]
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showElide visible: showElide
text: qsTr("Elide") text: qsTr("Elide")
disabledState: !backendValues.elide.isAvailable
} }
ComboBox { ComboBox {
@@ -97,12 +100,14 @@ Section {
backendValue: backendValues.elide backendValue: backendValues.elide
scope: "Text" scope: "Text"
model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"] model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"]
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showElide visible: showElide
text: qsTr("Maximum line count") text: qsTr("Maximum line count")
tooltip: qsTr("Limits the number of lines that the text item will show.") tooltip: qsTr("Limits the number of lines that the text item will show.")
disabledState: !backendValues.maximumLineCount.isAvailable
} }
SpinBox { SpinBox {
@@ -112,6 +117,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
Label { Label {
@@ -135,6 +141,7 @@ Section {
Label { Label {
visible: showFormatProperty visible: showFormatProperty
text: qsTr("Format") text: qsTr("Format")
disabledState: !backendValues.textFormat.isAvailable
} }
ComboBox { ComboBox {
scope: "Text" scope: "Text"
@@ -142,23 +149,27 @@ Section {
model: ["PlainText", "RichText", "AutoText"] model: ["PlainText", "RichText", "AutoText"]
backendValue: backendValues.textFormat backendValue: backendValues.textFormat
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Render type") text: qsTr("Render type")
toolTip: qsTr("Overrides the default rendering type for this item.") toolTip: qsTr("Overrides the default rendering type for this item.")
disabledState: !backendValues.renderType.isAvailable
} }
ComboBox { ComboBox {
scope: "Text" scope: "Text"
model: ["QtRendering", "NativeRendering"] model: ["QtRendering", "NativeRendering"]
backendValue: backendValues.renderType backendValue: backendValues.renderType
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showFontSizeMode visible: showFontSizeMode
text: qsTr("Font size mode") text: qsTr("Font size mode")
toolTip: qsTr("Specifies how the font size of the displayed text is determined.") toolTip: qsTr("Specifies how the font size of the displayed text is determined.")
disabledState: !backendValues.fontSizeMode.isAvailable
} }
ComboBox { ComboBox {
id: fontSizeMode id: fontSizeMode
@@ -167,17 +178,20 @@ Section {
model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"] model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"]
backendValue: backendValues.fontSizeMode backendValue: backendValues.fontSizeMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showFontSizeMode visible: showFontSizeMode
text: qsTr("Minimum size") text: qsTr("Minimum size")
disabledState: !backendValues.minimumPixelSize.isAvailable
&& !backendValues.minimumPointSize.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
visible: showFontSizeMode visible: showFontSizeMode
SpinBox { SpinBox {
enabled: fontSizeMode.currentIndex !== 0 enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
minimumValue: 0 minimumValue: 0
maximumValue: 500 maximumValue: 500
decimals: 0 decimals: 0
@@ -189,6 +203,7 @@ Section {
text: qsTr("Pixel") text: qsTr("Pixel")
tooltip: qsTr("Minimum font pixel size of scaled text.") tooltip: qsTr("Minimum font pixel size of scaled text.")
width: 42 width: 42
disabledStateSoft: !backendValues.minimumPixelSize.isAvailable
} }
Item { Item {
@@ -197,7 +212,7 @@ Section {
} }
SpinBox { SpinBox {
enabled: fontSizeMode.currentIndex !== 0 enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
minimumValue: 0 minimumValue: 0
maximumValue: 500 maximumValue: 500
decimals: 0 decimals: 0
@@ -209,6 +224,7 @@ Section {
text: qsTr("Point") text: qsTr("Point")
tooltip: qsTr("Minimum font point size of scaled text.") tooltip: qsTr("Minimum font point size of scaled text.")
width: 42 width: 42
disabledStateSoft: !backendValues.minimumPointSize.isAvailable
} }
} }
@@ -216,9 +232,11 @@ Section {
visible: showLineHeight visible: showLineHeight
text: qsTr("Line height") text: qsTr("Line height")
tooltip: qsTr("Line height for the text.") tooltip: qsTr("Line height for the text.")
disabledState: !lineHeightSpinBox.enabled
} }
SpinBox { SpinBox {
id: lineHeightSpinBox
visible: showLineHeight visible: showLineHeight
Layout.fillWidth: true Layout.fillWidth: true
backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight
@@ -226,12 +244,14 @@ Section {
minimumValue: 0 minimumValue: 0
decimals: 2 decimals: 2
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showLineHeight visible: showLineHeight
text: qsTr("Line height mode") text: qsTr("Line height mode")
toolTip: qsTr("Determines how the line height is specified.") toolTip: qsTr("Determines how the line height is specified.")
disabledState: !backendValues.lineHeightMode.isAvailable
} }
ComboBox { ComboBox {
visible: showLineHeight visible: showLineHeight
@@ -239,6 +259,7 @@ Section {
model: ["ProportionalHeight", "FixedHeight"] model: ["ProportionalHeight", "FixedHeight"]
backendValue: backendValues.lineHeightMode backendValue: backendValues.lineHeightMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
} }

View File

@@ -34,7 +34,7 @@ RowLayout {
property variant backendValue property variant backendValue
property color textColor: colorLogic.highlight ? colorLogic.textColor : "white" property color textColor: colorLogic.highlight ? colorLogic.textColor : "white"
property string filter: "*.png *.gif *.jpg *.bmp *.jpeg *.svg *.pbm *.pgm *.ppm *.xbm *.xpm" property string filter: "*.png *.gif *.jpg *.bmp *.jpeg *.svg *.pbm *.pgm *.ppm *.xbm *.xpm *.hdr"
FileResourcesModel { FileResourcesModel {
id: fileModel id: fileModel

View File

@@ -17,11 +17,12 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
ListView { ListView {
id: listView
width: parent.width width: parent.width
model: 20 model: 20
delegate: ItemDelegate { delegate: ItemDelegate {
text: "Item " + (index + 1) text: "Item " + (index + 1)
width: parent.width width: listView.width
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -42,8 +42,7 @@ bool AndroidServiceData::isValid() const
{ {
return !m_className.isEmpty() return !m_className.isEmpty()
&& (!m_isRunInExternalProcess || !m_externalProcessName.isEmpty()) && (!m_isRunInExternalProcess || !m_externalProcessName.isEmpty())
&& (!m_isRunInExternalLibrary || !m_externalLibName.isEmpty()) && (!m_isRunInExternalLibrary || !m_externalLibName.isEmpty());
&& (m_isRunInExternalLibrary || !m_serviceArguments.isEmpty());
} }
void AndroidServiceData::setClassName(const QString &className) void AndroidServiceData::setClassName(const QString &className)
@@ -264,8 +263,6 @@ QVariant AndroidServiceWidget::AndroidServiceModel::data(const QModelIndex &inde
return tr("The process name must be set for a service run in an external process"); return tr("The process name must be set for a service run in an external process");
else if (index.column() == 4 && m_services[index.row()].isRunInExternalLibrary()) else if (index.column() == 4 && m_services[index.row()].isRunInExternalLibrary())
return tr("The library name must be set for a service run in an external library"); return tr("The library name must be set for a service run in an external library");
else if (index.column() == 5 && !m_services[index.row()].isRunInExternalLibrary())
return tr("The service arguments must be set for a service not run in an external library");
} else if (role == Qt::EditRole) { } else if (role == Qt::EditRole) {
if (index.column() == 0) if (index.column() == 0)
return m_services[index.row()].className(); return m_services[index.row()].className();
@@ -287,10 +284,6 @@ QVariant AndroidServiceWidget::AndroidServiceModel::data(const QModelIndex &inde
if (m_services[index.row()].isRunInExternalLibrary() if (m_services[index.row()].isRunInExternalLibrary()
&& m_services[index.row()].externalLibraryName().isEmpty()) && m_services[index.row()].externalLibraryName().isEmpty())
return Utils::Icons::WARNING.icon(); return Utils::Icons::WARNING.icon();
} else if (index.column() == 5) {
if (!m_services[index.row()].isRunInExternalLibrary()
&& m_services[index.row()].serviceArguments().isEmpty())
return Utils::Icons::WARNING.icon();
} }
} }
return {}; return {};

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmacro.h> #include <projectexplorer/projectmacro.h>
#include <utils/algorithm.h>
#include <utils/cpplanguage_details.h> #include <utils/cpplanguage_details.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -137,7 +138,7 @@ QStringList CompilerOptionsBuilder::build(ProjectFile::Kind fileKind,
addTargetTriple(); addTargetTriple();
updateFileLanguage(fileKind); updateFileLanguage(fileKind);
addLanguageVersionAndExtensions(); addLanguageVersionAndExtensions();
enableExceptions(); addMsvcExceptions();
addPrecompiledHeaderOptions(usePrecompiledHeaders); addPrecompiledHeaderOptions(usePrecompiledHeaders);
addProjectConfigFileInclude(); addProjectConfigFileInclude();
@@ -273,6 +274,17 @@ void CompilerOptionsBuilder::addCompilerFlags()
add(m_compilerFlags.flags); add(m_compilerFlags.flags);
} }
void CompilerOptionsBuilder::addMsvcExceptions()
{
if (!m_clStyle)
return;
if (Utils::anyOf(m_projectPart.toolChainMacros, [](const ProjectExplorer::Macro &macro) {
return macro.key == "_CPPUNWIND";
})) {
enableExceptions();
}
}
void CompilerOptionsBuilder::enableExceptions() void CompilerOptionsBuilder::enableExceptions()
{ {
// With "--driver-mode=cl" exceptions are disabled (clang 8). // With "--driver-mode=cl" exceptions are disabled (clang 8).

View File

@@ -68,6 +68,7 @@ public:
void addExtraCodeModelFlags(); void addExtraCodeModelFlags();
void addPicIfCompilerFlagsContainsIt(); void addPicIfCompilerFlagsContainsIt();
void addCompilerFlags(); void addCompilerFlags();
void addMsvcExceptions();
void enableExceptions(); void enableExceptions();
void insertWrappedQtHeaders(); void insertWrappedQtHeaders();
void insertWrappedMingwHeaders(); void insertWrappedMingwHeaders();

View File

@@ -26,6 +26,8 @@
#include "componentexporter.h" #include "componentexporter.h"
#include "exportnotification.h" #include "exportnotification.h"
#include "designdocument.h"
#include "qmldesignerplugin.h"
#include "rewriterview.h" #include "rewriterview.h"
#include "qmlitemnode.h" #include "qmlitemnode.h"
#include "qmlobjectnode.h" #include "qmlobjectnode.h"
@@ -163,7 +165,6 @@ void AssetExporter::exportComponent(const ModelNode &rootNode)
Component exporter(*this, rootNode); Component exporter(*this, rootNode);
exporter.exportComponent(); exporter.exportComponent();
m_components.append(exporter.json()); m_components.append(exporter.json());
notifyProgress((m_totalFileCount - m_exportFiles.count()) * 0.8 / m_totalFileCount);
} }
void AssetExporter::notifyLoadError(AssetExporterView::LoadState state) void AssetExporter::notifyLoadError(AssetExporterView::LoadState state)
@@ -192,12 +193,22 @@ void AssetExporter::onQmlFileLoaded()
{ {
QTC_ASSERT(m_view && m_view->model(), qCDebug(loggerError) << "Null model"; return); QTC_ASSERT(m_view && m_view->model(), qCDebug(loggerError) << "Null model"; return);
qCDebug(loggerInfo) << "Qml file load done" << m_view->model()->fileUrl(); qCDebug(loggerInfo) << "Qml file load done" << m_view->model()->fileUrl();
QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager()
.currentDesignDocument();
if (designDocument->hasQmlParseErrors()) {
ExportNotification::addError(tr("Cannot export QML. Document \"%1\" have parsing errors.")
.arg(designDocument->displayName()));
} else {
exportComponent(m_view->rootModelNode()); exportComponent(m_view->rootModelNode());
QString error; QString error;
if (!m_view->saveQmlFile(&error)) { if (!m_view->saveQmlFile(&error)) {
ExportNotification::addError(tr("Error saving QML file. %1") ExportNotification::addError(tr("Error saving QML file. %1")
.arg(error.isEmpty()? tr("Unknown") : error)); .arg(error.isEmpty()? tr("Unknown") : error));
} }
}
notifyProgress((m_totalFileCount - m_exportFiles.count()) * 0.8 / m_totalFileCount);
triggerLoadNextFile(); triggerLoadNextFile();
} }

View File

@@ -30,6 +30,7 @@
#include "model.h" #include "model.h"
#include "nodeabstractproperty.h" #include "nodeabstractproperty.h"
#include "nodemetainfo.h"
#include "rewriterview.h" #include "rewriterview.h"
#include "utils/qtcassert.h" #include "utils/qtcassert.h"
@@ -41,13 +42,16 @@
namespace { namespace {
Q_LOGGING_CATEGORY(loggerInfo, "qtc.designer.assetExportPlugin.modelExporter", QtInfoMsg) Q_LOGGING_CATEGORY(loggerInfo, "qtc.designer.assetExportPlugin.modelExporter", QtInfoMsg)
static void populateLineage(const QmlDesigner::ModelNode &node, QByteArrayList &lineage) static QByteArrayList populateLineage(const QmlDesigner::ModelNode &node)
{ {
QByteArrayList lineage;
if (!node.isValid() || node.type().isEmpty()) if (!node.isValid() || node.type().isEmpty())
return; return {};
lineage.append(node.type());
if (node.hasParentProperty()) for (auto &info : node.metaInfo().superClasses())
populateLineage(node.parentProperty().parentModelNode(), lineage); lineage.append(info.typeName());
return lineage;
} }
} }
@@ -86,8 +90,7 @@ void Component::exportComponent()
ModelNodeParser *Component::createNodeParser(const ModelNode &node) const ModelNodeParser *Component::createNodeParser(const ModelNode &node) const
{ {
QByteArrayList lineage; QByteArrayList lineage = populateLineage(node);
populateLineage(node, lineage);
std::unique_ptr<ModelNodeParser> reader; std::unique_ptr<ModelNodeParser> reader;
for (auto &parserCreator: m_readers) { for (auto &parserCreator: m_readers) {
std::unique_ptr<ModelNodeParser> r(parserCreator->instance(lineage, node)); std::unique_ptr<ModelNodeParser> r(parserCreator->instance(lineage, node));
@@ -110,6 +113,11 @@ ModelNodeParser *Component::createNodeParser(const ModelNode &node) const
QJsonObject Component::nodeToJson(const ModelNode &node) QJsonObject Component::nodeToJson(const ModelNode &node)
{ {
QJsonObject jsonObject; QJsonObject jsonObject;
// Don't export States, Connection, Timeline etc nodes.
if (!node.isSubclassOf("QtQuick.Item"))
return {};
std::unique_ptr<ModelNodeParser> parser(createNodeParser(node)); std::unique_ptr<ModelNodeParser> parser(createNodeParser(node));
if (parser) { if (parser) {
if (parser->uuid().isEmpty()) { if (parser->uuid().isEmpty()) {
@@ -120,13 +128,16 @@ QJsonObject Component::nodeToJson(const ModelNode &node)
} }
jsonObject = parser->json(*this); jsonObject = parser->json(*this);
} else { } else {
ExportNotification::addError(tr("Error exporting component %1. Parser unavailable.") ExportNotification::addError(tr("Error exporting node %1. Cannot parse type %2.")
.arg(node.id())); .arg(node.id()).arg(QString::fromUtf8(node.type())));
} }
QJsonArray children; QJsonArray children;
for (const ModelNode &childnode : node.directSubModelNodes()) for (const ModelNode &childnode : node.directSubModelNodes()) {
children.append(nodeToJson(childnode)); const QJsonObject childJson = nodeToJson(childnode);
if (!childJson.isEmpty())
children.append(childJson);
}
if (!children.isEmpty()) if (!children.isEmpty())
jsonObject.insert(ChildrenTag, children); jsonObject.insert(ChildrenTag, children);

View File

@@ -1297,6 +1297,9 @@ void DesignerActionManager::createDefaultAddResourceHandler()
registerAddResourceHandler(AddResourceHandler(ComponentCoreConstants::addImagesDisplayString, registerAddResourceHandler(AddResourceHandler(ComponentCoreConstants::addImagesDisplayString,
"*.svg", "*.svg",
ModelNodeOperations::addImageToProject)); ModelNodeOperations::addImageToProject));
registerAddResourceHandler(AddResourceHandler(ComponentCoreConstants::addImagesDisplayString,
"*.hdr",
ModelNodeOperations::addImageToProject));
registerAddResourceHandler(AddResourceHandler(ComponentCoreConstants::addFontsDisplayString, registerAddResourceHandler(AddResourceHandler(ComponentCoreConstants::addFontsDisplayString,
"*.ttf", "*.ttf",

View File

@@ -298,7 +298,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const QStyleOptionVie
auto addMetaInfoProperties = [&](const NodeMetaInfo& itemMetaInfo, QString itemName){ auto addMetaInfoProperties = [&](const NodeMetaInfo& itemMetaInfo, QString itemName){
if (itemMetaInfo.isValid()) { if (itemMetaInfo.isValid()) {
for (const PropertyName &propertyName : itemMetaInfo.directPropertyNames()) { for (const PropertyName &propertyName : itemMetaInfo.propertyNames()) {
TypeName propertyType = itemMetaInfo.propertyTypeName(propertyName); TypeName propertyType = itemMetaInfo.propertyTypeName(propertyName);
if (!propertyType.isEmpty()) { if (!propertyType.isEmpty()) {
//first letter is a reliable item indicator //first letter is a reliable item indicator

View File

@@ -112,7 +112,7 @@ void Edit3DView::updateActiveScene3D(const QVariantMap &sceneState)
if (sceneState.contains(sceneKey)) { if (sceneState.contains(sceneKey)) {
qint32 newActiveScene = sceneState[sceneKey].value<qint32>(); qint32 newActiveScene = sceneState[sceneKey].value<qint32>();
edit3DWidget()->canvas()->updateActiveScene(newActiveScene); edit3DWidget()->canvas()->updateActiveScene(newActiveScene);
rootModelNode().setAuxiliaryData("active3dScene", newActiveScene); rootModelNode().setAuxiliaryData("active3dScene@Internal", newActiveScene);
} }
if (sceneState.contains(selectKey)) if (sceneState.contains(selectKey))

View File

@@ -702,6 +702,8 @@ void FormEditorView::instanceInformationsChanged(const QMultiHash<ModelNode, Inf
} }
} }
scene()->update();
m_currentTool->formEditorItemsChanged(changedItems); m_currentTool->formEditorItemsChanged(changedItems);
} }

View File

@@ -99,15 +99,15 @@ void ImportsWidget::setPossibleImports(QList<Import> possibleImports)
QList<Import> filteredImports; QList<Import> filteredImports;
const QStringList mcuWhiteList = {"QtQuick", "QtQuick.Controls", "QtQuick.Timeline"}; const QStringList mcuPostiveList = {"QtQuick", "QtQuick.Controls", "QtQuick.Timeline"};
const QStringList mcuBlackList = {"FlowView"}; const QStringList mcuNegativeList = {"FlowView"};
if (isQtForMCUs) { if (isQtForMCUs) {
filteredImports = Utils::filtered(possibleImports, filteredImports = Utils::filtered(possibleImports,
[mcuWhiteList, mcuBlackList](const Import &import) { [mcuPostiveList, mcuNegativeList](const Import &import) {
return (mcuWhiteList.contains(import.url()) return (mcuPostiveList.contains(import.url())
|| !import.url().startsWith("Qt")) || !import.url().startsWith("Qt"))
&& !mcuBlackList.contains(import.url()); && !mcuNegativeList.contains(import.url());
}); });
} else { } else {
filteredImports = possibleImports; filteredImports = possibleImports;

View File

@@ -33,6 +33,9 @@
#include <nodehints.h> #include <nodehints.h>
#include <nodemetainfo.h> #include <nodemetainfo.h>
#include <designdocument.h>
#include <qmldesignerplugin.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -197,9 +200,56 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
forceVisiblity = isItem; forceVisiblity = isItem;
} }
DesignDocument *designDocument = QmlDesignerPlugin::instance()
->documentManager()
.currentDesignDocument();
if (valid if (designDocument && designDocument->isQtForMCUsProject()) {
&& (isItem || forceVisiblity) //We can change if the navigator does support pure QObjects const QList<TypeName> blockTypes = {"QtQuick.AnimatedImage",
"QtQuick.BorderImage",
"QtQuick.FocusScope",
"QtQuick.TextInput",
"QtQuick.TextEdit",
"QtQuick.Flow",
"QtQuick.Grid",
"QtQuick.GridView",
"QtQuick.PathView",
"QtQuick.Controls",
"QtQuick.Controls.BusyIndicator",
"QtQuick.Controls.ButtonGroup",
"QtQuick.Controls.CheckDelegate",
"QtQuick.Controls.Container",
"QtQuick.Controls.ComboBox",
"QtQuick.Controls.DelayButton",
"QtQuick.Controls.Frame",
"QtQuick.Controls.GroupBox",
"QtQuick.Controls.ItemDelegate",
"QtQuick.Controls.Label",
"QtQuick.Controls.Page",
"QtQuick.Controls.PageIndicator",
"QtQuick.Controls.Pane",
"QtQuick.Controls.RadioDelegate",
"QtQuick.Controls.RangeSlider",
"QtQuick.Controls.RoundButton",
"QtQuick.Controls.ScrollView",
"QtQuick.Controls.SpinBox",
"QtQuick.Controls.StackView",
"QtQuick.Controls.SwipeDelegate",
"QtQuick.Controls.SwitchDelegate",
"QtQuick.Controls.ToolBar",
"QtQuick.Controls.ToolButton",
"QtQuick.Controls.TabBar",
"QtQuick.Controls.TabButton",
"QtQuick.Controls.TextArea",
"QtQuick.Controls.TextField",
"QtQuick.Controls.ToolSeparator",
"QtQuick.Controls.Tumbler"};
if (blockTypes.contains(entry.typeName()))
valid = false;
}
if (valid && (isItem || forceVisiblity) //We can change if the navigator does support pure QObjects
&& (entry.requiredImport().isEmpty() && (entry.requiredImport().isEmpty()
|| model->hasImport(entryToImport(entry), true, true))) { || model->hasImport(entryToImport(entry), true, true))) {
QString itemSectionName = entry.category(); QString itemSectionName = entry.category();

View File

@@ -351,6 +351,8 @@ void ItemLibraryWidget::reloadQmlSource()
void ItemLibraryWidget::setupImportTagWidget() void ItemLibraryWidget::setupImportTagWidget()
{ {
QTC_ASSERT(m_model, return); QTC_ASSERT(m_model, return);
const DesignDocument *designDocument = QmlDesignerPlugin::instance()->currentDesignDocument();
const bool isQtForMCUs = designDocument && designDocument->isQtForMCUsProject();
const QStringList imports = m_model->metaInfo().itemLibraryInfo()->showTagsForImports(); const QStringList imports = m_model->metaInfo().itemLibraryInfo()->showTagsForImports();
@@ -373,12 +375,14 @@ void ItemLibraryWidget::setupImportTagWidget()
return button; return button;
}; };
if (!isQtForMCUs) {
for (const QString &importPath : imports) { for (const QString &importPath : imports) {
const Import import = Import::createLibraryImport(importPath); const Import import = Import::createLibraryImport(importPath);
if (!m_model->hasImport(import, true, true) if (!m_model->hasImport(import, true, true)
&& m_model->isImportPossible(import, true, true)) && m_model->isImportPossible(import, true, true))
flowLayout->addWidget(createButton(importPath)); flowLayout->addWidget(createButton(importPath));
} }
}
} }
void ItemLibraryWidget::updateModel() void ItemLibraryWidget::updateModel()

View File

@@ -272,21 +272,68 @@ static bool itemOrImage(const QmlDesigner::NodeMetaInfo &metaInfo)
return false; return false;
} }
static QList<QByteArray> prepareNonMcuProperties()
{
QList<QByteArray> result;
const QList<QByteArray> itemProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing",
"border", "baselineOffset", "focus", "activeFocusOnTab"};
const QList<QByteArray> mouseAreaProperties = {"propagateComposedEvents", "preventStealing", "cursorShape",
"scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"};
const QList<QByteArray> flickableProperties = {"boundsBehavior", "boundsMovement",
"flickDeceleration", "flickableDirection",
"leftMargin", "rightMargin", "bottomMargin", "topMargin",
"originX", "originY",
"pixelAligned", "pressDelay", "synchronousDrag"};
const QList<QByteArray> imageProperties = {"mirror", "mipmap", "cache", "autoTransform", "asynchronous",
"sourceSize", "smooth"};
const QList<QByteArray> textProperties = {"elide", "lineHeight", "lineHeightMode", "wrapMode", "style",
"styleColor", "minimumPointSize", "minimumPixelSize", "styleColor",
"fontSizeMode", "renderType", "textFormat", "maximumLineCount"};
const QList<QByteArray> paddingProperties = {"bottomPadding", "topPadding", "leftPadding", "rightPadding"};
const QList<QByteArray> columnRowProperties = {"layoutDirection"};
const QList<QByteArray> listViewProperties = {"cacheBuffer", "highlightRangeMode", "highlightMoveDuration",
"highlightResizeDuration", "preferredHighlightBegin", "layoutDirection",
"preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps",
"snapMode", "highlightMoveVelocity", "highlightResizeVelocity"};
result.append(itemProperties);
result.append(mouseAreaProperties);
result.append(flickableProperties);
result.append(imageProperties);
result.append(textProperties);
result.append(paddingProperties);
result.append(columnRowProperties);
result.append(listViewProperties);
return result;
}
bool PropertyEditorValue::isAvailable() const bool PropertyEditorValue::isAvailable() const
{ {
const QList<QByteArray> mcuProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing"}; const QList<QByteArray> nonMcuProperties = prepareNonMcuProperties();
const QByteArray fontPrefix = {"font"};
const QList<QByteArray> nonMcuFontProperties = {"wordSpacing", "letterSpacing", "hintingPreference",
"kerning", "preferShaping", "capitalization",
"strikeout", "underline", "styleName"};
const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"}; const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"};
const QList<QByteArray> list = name().split('.'); const QList<QByteArray> list = name().split('.');
const QByteArray pureName = list.first(); const QByteArray pureName = list.constFirst();
QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager() ->documentManager()
.currentDesignDocument(); .currentDesignDocument();
if (designDocument && designDocument->isQtForMCUsProject()) { if (designDocument && designDocument->isQtForMCUsProject()) {
if (mcuProperties.contains(pureName)) if (pureName == fontPrefix) {
if (nonMcuFontProperties.contains(list.constLast()))
return false;
}
if (nonMcuProperties.contains(pureName))
return false; return false;
if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo())) if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo()))
return false; return false;

View File

@@ -207,20 +207,20 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e)
{ {
m_curve.clearActive(); m_curve.clearActive();
QMenu menu; auto *menu = new QMenu(this);
EasingCurve mappedCurve = m_canvas.mapTo(m_curve); EasingCurve mappedCurve = m_canvas.mapTo(m_curve);
int index = mappedCurve.hit(e->pos(), 10); int index = mappedCurve.hit(e->pos(), 10);
if (index > 0 && !m_curve.isHandle(index)) { if (index > 0 && !m_curve.isHandle(index)) {
QAction *deleteAction = menu.addAction(tr("Delete Point")); QAction *deleteAction = menu->addAction(tr("Delete Point"));
connect(deleteAction, &QAction::triggered, [this, index]() { connect(deleteAction, &QAction::triggered, [this, index]() {
m_curve.deletePoint(index); m_curve.deletePoint(index);
update(); update();
emit easingCurveChanged(m_curve); emit easingCurveChanged(m_curve);
}); });
QAction *smoothAction = menu.addAction(tr("Smooth Point")); QAction *smoothAction = menu->addAction(tr("Smooth Point"));
smoothAction->setCheckable(true); smoothAction->setCheckable(true);
smoothAction->setChecked(m_curve.isSmooth(index)); smoothAction->setChecked(m_curve.isSmooth(index));
connect(smoothAction, &QAction::triggered, [this, index]() { connect(smoothAction, &QAction::triggered, [this, index]() {
@@ -229,7 +229,7 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e)
emit easingCurveChanged(m_curve); emit easingCurveChanged(m_curve);
}); });
QAction *cornerAction = menu.addAction(tr("Corner Point")); QAction *cornerAction = menu->addAction(tr("Corner Point"));
connect(cornerAction, &QAction::triggered, [this, index]() { connect(cornerAction, &QAction::triggered, [this, index]() {
m_curve.breakTangent(index); m_curve.breakTangent(index);
update(); update();
@@ -237,7 +237,7 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e)
}); });
} else { } else {
QAction *addAction = menu.addAction(tr("Add Point")); QAction *addAction = menu->addAction(tr("Add Point"));
connect(addAction, &QAction::triggered, [&]() { connect(addAction, &QAction::triggered, [&]() {
m_curve.addPoint(m_canvas.mapFrom(e->pos())); m_curve.addPoint(m_canvas.mapFrom(e->pos()));
m_curve.makeSmooth(m_curve.active()); m_curve.makeSmooth(m_curve.active());
@@ -246,13 +246,13 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e)
}); });
} }
QAction *zoomAction = menu.addAction(tr("Reset Zoom")); QAction *zoomAction = menu->addAction(tr("Reset Zoom"));
connect(zoomAction, &QAction::triggered, [&]() { connect(zoomAction, &QAction::triggered, [&]() {
m_canvas.setScale(1.0); m_canvas.setScale(1.0);
update(); update();
}); });
menu.exec(e->globalPos()); menu->exec(e->globalPos());
e->accept(); e->accept();
} }

View File

@@ -548,7 +548,6 @@ QString RewriterView::auxiliaryDataAsQML() const
for (const auto &node : allModelNodes()) { for (const auto &node : allModelNodes()) {
QHash<PropertyName, QVariant> data = node.auxiliaryData(); QHash<PropertyName, QVariant> data = node.auxiliaryData();
if (!data.isEmpty()) { if (!data.isEmpty()) {
hasAuxData = true;
if (columnCount > 80) { if (columnCount > 80) {
str += "\n"; str += "\n";
columnCount = 0; columnCount = 0;
@@ -567,7 +566,6 @@ QString RewriterView::auxiliaryDataAsQML() const
keys.sort(); keys.sort();
for (const QString &key : keys) { for (const QString &key : keys) {
if (key.endsWith("@NodeInstance")) if (key.endsWith("@NodeInstance"))
continue; continue;
@@ -579,7 +577,7 @@ QString RewriterView::auxiliaryDataAsQML() const
if (!key.contains(safeName)) if (!key.contains(safeName))
continue; continue;
hasAuxData = true;
const QVariant value = data.value(key.toUtf8()); const QVariant value = data.value(key.toUtf8());
QString strValue = value.toString(); QString strValue = value.toString();

View File

@@ -35,7 +35,7 @@ ListModel {
ListElement { ListElement {
projectName: "CoffeeMachine" projectName: "CoffeeMachine"
qmlFileName: "ApplicationFlowForm.ui.qml" qmlFileName: "CoffeeMachine.qml"
thumbnail: "images/coffeemachinedemo_thumbnail.png" thumbnail: "images/coffeemachinedemo_thumbnail.png"
displayName: "Coffee Machine" displayName: "Coffee Machine"
} }

View File

@@ -91,4 +91,46 @@ ListModel {
thumbnail: "images/what_is_new_15.png" thumbnail: "images/what_is_new_15.png"
url: "https://www.youtube.com/watch?v=e-HAZrisi5o" url: "https://www.youtube.com/watch?v=e-HAZrisi5o"
} }
ListElement {
displayName: "Qt Design Studio QuickTip: UI Navigation"
thumbnail: "images/Qt_QT_nav.png"
url: "https://youtu.be/RfEYO-5Mw6s"
}
ListElement {
displayName: "Qt Design Studio QuickTip: Text Element"
thumbnail: "images/Qt_QT_textElement.png"
url: "https://youtu.be/yOUdg1o2KJM"
}
ListElement {
displayName: "Qt Design Studio QuickTip: Animated Image"
thumbnail: "images/Qt_QT_animatedImage.png"
url: "https://youtu.be/DVWd_xMMgvg"
}
ListElement {
displayName: "Qt Design Studio QuickTip: Slider Control"
thumbnail: "images/Qt_QT_sliderControl.png"
url: "https://youtu.be/Ed8WS03C-Vk"
}
ListElement {
displayName: "Qt Design Studio QuickTip: Bindings"
thumbnail: "images/Qt_QT_bindings.png"
url: "https://youtu.be/UfvA04CIXv0"
}
ListElement {
displayName: "Sketch Bridge Tutorial - Part 1"
thumbnail: "images/sketchTutorial_1.png"
url: "https://www.qt.io/blog/qt-design-studio-sketch-bridge-tutorial-part-1"
}
ListElement {
displayName: "Sketch Bridge Tutorial - Part 2"
thumbnail: "images/sketchTutorial_2.png"
url: "https://www.qt.io/blog/qt-design-studio-sketch-bridge-tutorial-part-2"
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -650,8 +650,6 @@ TEST_F(CompilerOptionsBuilder, BuildAllOptions)
"-x", "-x",
"c++", "c++",
"-std=c++17", "-std=c++17",
"-fcxx-exceptions",
"-fexceptions",
"-DprojectFoo=projectBar", "-DprojectFoo=projectBar",
"-I", IsPartOfHeader("wrappedQtHeaders"), "-I", IsPartOfHeader("wrappedQtHeaders"),
"-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()), "-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()),
@@ -674,6 +672,44 @@ TEST_F(CompilerOptionsBuilder, BuildAllOptionsCl)
compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No);
ASSERT_THAT(compilerOptionsBuilder.options(),
ElementsAre("-nostdinc",
"-nostdinc++",
"--driver-mode=cl",
"/Zs",
"-m64",
"--target=x86_64-apple-darwin10",
"/TP",
"/std:c++17",
"-fms-compatibility-version=19.00",
"-DprojectFoo=projectBar",
"-D__FUNCSIG__=\"\"",
"-D__FUNCTION__=\"\"",
"-D__FUNCDNAME__=\"\"",
"-I", IsPartOfHeader("wrappedQtHeaders"),
"-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()),
"-I", toNative("/tmp/path"),
"-I", toNative("/tmp/system_path"),
"/clang:-isystem",
"/clang:" + toNative(CLANG_INCLUDE_DIR ""),
"/clang:-isystem",
"/clang:" + toNative("/tmp/builtin_path")));
}
TEST_F(CompilerOptionsBuilder, BuildAllOptionsClWithExceptions)
{
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
projectPart.toolChainMacros.append(ProjectExplorer::Macro{"_CPPUNWIND", "1"});
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
CppTools::UseSystemHeader::No,
CppTools::UseTweakedHeaderPaths::Yes,
CppTools::UseLanguageDefines::No,
CppTools::UseBuildSystemWarnings::No,
"dummy_version",
"");
compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No);
ASSERT_THAT(compilerOptionsBuilder.options(), ASSERT_THAT(compilerOptionsBuilder.options(),
ElementsAre("-nostdinc", ElementsAre("-nostdinc",
"-nostdinc++", "-nostdinc++",

View File

@@ -25,6 +25,7 @@
#include <QtGlobal> #include <QtGlobal>
#ifdef CLANG_UNIT_TESTS
#include <clang-c/Index.h> #include <clang-c/Index.h>
#if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR == 59 #if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR == 59
@@ -32,6 +33,7 @@
#else #else
# define DISABLED_FOR_CLANG_10(x) x # define DISABLED_FOR_CLANG_10(x) x
#endif #endif
#endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# define DISABLED_ON_WINDOWS(x) DISABLED_##x # define DISABLED_ON_WINDOWS(x) DISABLED_##x

View File

@@ -65,6 +65,12 @@ class StringCache : public testing::Test
protected: protected:
void SetUp() void SetUp()
{ {
mockStorageFetchDirectyId = [&](Utils::SmallStringView string) {
return mockStorage.fetchDirectoryId(string);
};
mockStorageFetchDirectyPath = [&](int id) {
return mockStorage.fetchDirectoryPath(id);
};
std::sort(filePaths.begin(), filePaths.end(), [](auto &f, auto &l) { std::sort(filePaths.begin(), filePaths.end(), [](auto &f, auto &l) {
return compare(f, l) < 0; return compare(f, l) < 0;
}); });
@@ -82,12 +88,8 @@ protected:
protected: protected:
NiceMock<MockSqliteDatabase> mockDatabase; NiceMock<MockSqliteDatabase> mockDatabase;
NiceMock<MockFilePathStorage> mockStorage{mockDatabase}; NiceMock<MockFilePathStorage> mockStorage{mockDatabase};
StorageIdFunction mockStorageFetchDirectyId = [&](Utils::SmallStringView string) { StorageIdFunction mockStorageFetchDirectyId;
return mockStorage.fetchDirectoryId(string); StorageStringFunction mockStorageFetchDirectyPath;
};
StorageStringFunction mockStorageFetchDirectyPath = [&](int id) {
return mockStorage.fetchDirectoryPath(id);
};
Cache cache; Cache cache;
typename Cache::MutexType &mockMutex = cache.mutex(); typename Cache::MutexType &mockMutex = cache.mutex();
Utils::PathString filePath1{"/file/pathOne"}; Utils::PathString filePath1{"/file/pathOne"};