aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/doc/src/external-resources.qdoc29
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h8
-rw-r--r--src/qml/memory/qv4mmdefs_p.h28
-rw-r--r--src/quick/doc/src/concepts/effects/sprites.qdoc60
-rw-r--r--src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc204
-rw-r--r--src/quick/doc/src/guidelines/qtquick-guidelines.qdoc50
-rw-r--r--src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc113
-rw-r--r--src/quick/doc/src/qtquick.qdoc1
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp4
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp29
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf12
11 files changed, 483 insertions, 55 deletions
diff --git a/src/qml/doc/src/external-resources.qdoc b/src/qml/doc/src/external-resources.qdoc
index 717e983517..c6c922c171 100644
--- a/src/qml/doc/src/external-resources.qdoc
+++ b/src/qml/doc/src/external-resources.qdoc
@@ -44,3 +44,32 @@
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
\title Mozilla Developer Network Date Reference
*/
+/*!
+ \externalpage hhttps://www.froglogic.com/squish/gui-testing
+ \title Squish
+*/
+/*!
+ \externalpage http://doc.qt.io/GammaRay
+ \title GammaRay
+*/
+/*!
+ \externalpage http://doc.qt.io/QtQmlLive
+ \title QmlLive
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-debugging-qml.html
+ \title QML Debugger
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-qml-performance-monitor.html
+ \title QML Profiler
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/index.html
+ \title Qt Creator Manual
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-editor-external.html
+ \title Qt Creator: Integrating 3rd Party Tools
+*/
+
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 9356670b6d..b2573b4491 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -304,9 +304,11 @@ bool ArrayData::getProperty(uint index, Property *p, PropertyAttributes *attrs)
}
*attrs = attributes(index);
- p->value = *(Index{ this, mapped });
- if (attrs->isAccessor())
- p->set = *(Index{ this, mapped + 1 /*Object::SetterOffset*/ });
+ if (p) {
+ p->value = *(Index{ this, mapped });
+ if (attrs->isAccessor())
+ p->set = *(Index{ this, mapped + 1 /*Object::SetterOffset*/ });
+ }
return true;
}
diff --git a/src/qml/memory/qv4mmdefs_p.h b/src/qml/memory/qv4mmdefs_p.h
index 3e2bae46c2..8a53492822 100644
--- a/src/qml/memory/qv4mmdefs_p.h
+++ b/src/qml/memory/qv4mmdefs_p.h
@@ -323,23 +323,23 @@ struct MarkStack {
#define DECLARE_HEAP_OBJECT_BASE(name, base) \
-struct name##OffsetStruct { \
- name##Members(name, HEAP_OBJECT_OFFSET_MEMBER_EXPANSION) \
-}; \
-struct name##SizeStruct : base, name##OffsetStruct {}; \
-struct name##Data { \
- typedef base SuperClass; \
- static Q_CONSTEXPR size_t baseOffset = sizeof(name##SizeStruct) - sizeof(name##OffsetStruct); \
- name##Members(name, HEAP_OBJECT_MEMBER_EXPANSION) \
-}; \
-Q_STATIC_ASSERT(sizeof(name##SizeStruct) == sizeof(name##Data) + name##Data::baseOffset); \
+ struct name##OffsetStruct { \
+ name##Members(name, HEAP_OBJECT_OFFSET_MEMBER_EXPANSION) \
+ }; \
+ struct name##SizeStruct : base, name##OffsetStruct {}; \
+ struct name##Data { \
+ typedef base SuperClass; \
+ static Q_CONSTEXPR size_t baseOffset = sizeof(name##SizeStruct) - sizeof(name##OffsetStruct); \
+ name##Members(name, HEAP_OBJECT_MEMBER_EXPANSION) \
+ }; \
+ Q_STATIC_ASSERT(sizeof(name##SizeStruct) == sizeof(name##Data) + name##Data::baseOffset); \
#define DECLARE_HEAP_OBJECT(name, base) \
-DECLARE_HEAP_OBJECT_BASE(name, base) \
-struct name : base, name##Data
+ DECLARE_HEAP_OBJECT_BASE(name, base) \
+ struct name : base, name##Data
#define DECLARE_EXPORTED_HEAP_OBJECT(name, base) \
-DECLARE_HEAP_OBJECT_BASE(name, base) \
-struct Q_QML_EXPORT name : base, name##Data
+ DECLARE_HEAP_OBJECT_BASE(name, base) \
+ struct Q_QML_EXPORT name : base, name##Data
#define DECLARE_MARKOBJECTS(class) \
static void markObjects(Heap::Base *b, MarkStack *stack) { \
diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc
index cb4d7e2ac6..004db90eb3 100644
--- a/src/quick/doc/src/concepts/effects/sprites.qdoc
+++ b/src/quick/doc/src/concepts/effects/sprites.qdoc
@@ -52,38 +52,38 @@ This allows you to easily insert a transitional animation between two different
\image spriteenginegraph.png
As an example, consider the above diagram which illustrates the sprites for a hypothetical 2D
-platform game character. The character starts by displaying the standing state. From this state,
-barring external input, he will transition to either the waiting animation, the walking animation,
-or play the standing animation again. Because the weights for those transitions are one, zero and three
-respectively, he has a one in four chance of playing the waiting animation when the standing animation
-finishes, and a three in four chance of playing the standing animation again. This allows for a character
+platform game character. The character starts by displaying the \e standing state. From this state,
+barring external input, he will transition to either the \e waiting animation, the \e walking animation,
+or play the \e standing animation again. Because the weights for those transitions are one, zero and three
+respectively, he has a one in four chance of playing the \e waiting animation when the \e standing animation
+finishes, and a three in four chance of playing the \e standing animation again. This allows for a character
who has a slightly animated and variable behavior while waiting.
-Because there is a zero weight transition to the walking animation, the standing animation will not normally
-transition there. But if you set the goal animation to be the walking animation, it would play the walking
-animation when it finished the standing animation. If it was previously in the waiting animation, it would
-finish playing that, then play the standing animation, then play the walking animation. It would then continue to
-play the walking animation until the goal animation is unset, at which point it would switch to the standing
-animation after finishing the walking animation.
-
-If you set the goal state then to the jumping animation, it would finish the walking animation before
-playing the jumping animation. Because the jumping animation does not transition to other states, it will still
-keep playing the jumping animation until the state is forced to change. In this example, you could set it back to
-walking and change to goal animation to walking or to nothing (which would lead it to play the standing animation
-after the walking animation). Note that by forcibly setting the animation, you can start playing the animation
+Because there is a zero weight transition to the \e walking animation, the \e standing animation will not normally
+transition there. But if you set the goal animation to be the \e walking animation, it would play the \e walking
+animation when it finished the \e standing animation. If it was previously in the \e waiting animation, it would
+finish playing that, then play the \e standing animation, then play the \e walking animation. It would then continue to
+play the \e walking animation until the goal animation is unset, at which point it would switch to the \e standing
+animation after finishing the \e walking animation.
+
+If you then set the goal state to the \e jumping animation, it would finish the \e walking animation before
+playing the \e jumping animation. Because the \e jumping animation does not transition to other states, it will still
+keep playing the \e jumping animation until the state is forced to change. In this example, you could set it back to
+\e walking and change the goal animation to \e walking or to nothing (which would lead it to play the \e standing animation
+after the \e walking animation). Note that by forcibly setting the animation, you can start playing the animation
immediately.
\section2 Input Format
-The file formats accepted by the sprite engine is the same as the file formats accepted by other QML types,
-such as \l Image. In order to animate the image however, the sprite engine requires the image file to contain
+The file formats accepted by the sprite engine are the same as the file formats accepted by other QML types,
+such as \l Image. In order to animate the image, however, the sprite engine requires the image file to contain
all of the frames of the animation. They should be arranged in a contiguous line, which may wrap from the right
edge of the file to a lower row starting from the left edge of the file (and which is placed directly below the
previous row).
\image spritecutting.png
-As an example, take the above image. For now just consider the black numbers, and assume the squares are 40x40 pixels.
+As an example, take the above image. For now, just consider the black numbers, and assume the squares are 40x40 pixels.
Normally, the image is read from the top-left corner. If you specified the frame size as 40x40 pixels, and a frame count
of 8, then it would read in the frames as they are numbered. The frame in the top left would be the first frame, the frame
in the top right would be the fifth frame, and then it would wrap to the next row (at pixel location 0,40 in the file) to read
@@ -97,9 +97,9 @@ The first 120x40 of the image will not be used, as it starts reading 40x40 block
When it reaches the end of the file at 160,0, it then starts to read the next row from 0,40.
The blue numbers show the frame numbers if you tried to load two frames of that size, starting from 40,40. Note
-that it is possible to load multiple sprites out of the one image file. The red, blue and black numbers can all
+that it is possible to load multiple sprites from one image file. The red, blue and black numbers can all
be loaded as separate animations to the same sprite engine. The following code loads the animations as per the image.
-It also specifies that animations are to played at 20 frames per second.
+It also specifies that animations are to be played at 20 frames per second.
\code
Sprite {
@@ -131,17 +131,17 @@ Sprite {
}
\endcode
-Frames within one animation must be the same size, however multiple animations within the same file
-do not. Sprites without a frameCount specified assume that they take the entire file, and you must specify
+Frames within one animation must be the same size. However, multiple animations within the same file
+do not. Sprites without a \l {Sprite::}{frameCount} specified assume that they take the entire file, and you must specify
the frame size. Sprites without a frame size assume that they are square and take the entire file without wrapping,
and you must specify a frame count.
-The sprite engine internally copies and cuts up images to fit in an easier to read internal format, which leads
+The sprite engine internally copies and cuts up images to fit in an easier-to-read internal format, which leads
to some graphics memory limitations. Because it requires all the sprites for a single engine to be in the same
texture, attempting to load many different animations can run into texture memory limits on embedded devices. In
these situations, a warning will be output to the console containing the maximum texture size.
-There are several tools to help turn a set of images into sprite sheets, here are some examples:
+There are several tools to help turn a set of images into sprite sheets. Here are some examples:
\list
\li Photoshop plugin: \l http://www.johnwordsworth.com/projects/photoshop-sprite-sheet-generator-script
\li Gimp plugin: \l http://registry.gimp.org/node/20943
@@ -150,23 +150,23 @@ There are several tools to help turn a set of images into sprite sheets, here ar
\section2 QML Types Using the Sprite Engine
-Sprites for the sprite engine can be defined using the \l Sprite type. This type includes the input parameters
+Sprites for the sprite engine can be defined using the \l Sprite type. This type includes the input parameters,
as well as the length of the animation and weighted transitions to other animations. It is purely a data class, and
does not render anything.
\l SpriteSequence is a type which uses a sprite engine to draw the sprites defined in it. It is a single and
self-contained sprite engine, and does not interact with other sprite engines. \l Sprite types can be shared between
-sprite engine using types, but this is not done automatically. So if you have defined a sprite in one \l SpriteSequence
+sprite engine-using types, but this is not done automatically. So, if you have defined a sprite in one \l SpriteSequence
you will need to redefine it (or reference the same \l Sprite type) in the sprites property of another \l SpriteSequence
in order to transition to that animation.
Additionally, \l ImageParticle can use \l Sprite types to define sprites for each particle. This is again a single
-sprite engine per type. This works similarly to SpriteSequence, but it also has the parametrized variability provided
+sprite engine per type. This works similarly to \c SpriteSequence, but it also has the parameterized variability provided
by the \l ImageParticle type.
\section1 AnimatedSprite Type
-For use-cases which do not need to transition between animations, consider the AnimatedSprite type.
+For use-cases which do not need to transition between animations, consider the \l AnimatedSprite type.
This type displays sprite animations with the same input format, but only one at a time. It also provides more fine-grained
manual control, as there is no sprite engine managing the timing and transitions behind the scenes.
diff --git a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
new file mode 100644
index 0000000000..6327ea67e6
--- /dev/null
+++ b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 qtquick-bestpractices.html
+\title Qt Quick Best Practices
+\brief Lists the practices that works best for Qt Quick
+
+Besides all the benefits that Qt Quick offers, it can be challenging in certain
+situations. For example, a Qt Quick application with a large codebase can be
+painful to maintain if not organized well. The following sections elaborate
+on some of the best practices that will help you get better results.
+
+\section1 Custom UI Controls
+
+A fluid and modern UI is key for any application's success in today's world, and
+that's where QML makes so much sense for a designer or developer. Qt offers the
+most basic UI controls that are necessary to a create fluid and modern-looking
+UI. It is recommended to browse this list of UI controls before creating your
+own custom UI control.
+
+Besides these basic UI controls offered by Qt Quick itself, a rich set of UI
+controls are also available with Qt Quick Controls 2. They cater to the most
+common use cases without any change, and offer a lot more possibilities with their
+customization options. In particular, Qt Quick Controls 2 provides styling
+options that align with the latest UI design trends. If these UI controls do not
+satisfy to your application's needs, only then it is recommended to create a
+custom control.
+
+
+\section2 Related Information
+\list
+\li \l{Qt Quick Controls 2}
+\li \l{Qt Quick}
+\endlist
+
+\section1 Keep it Short and Simple or "KiSS"
+
+QML being a declarative language, a lot of the details are worked out by the underlying
+engine. So it is important for any QML application, especially one with a
+larger codebase, to have its code organized in smaller and simpler \c .qml files.
+
+\omit
+need a few snippet or example applications that showcase this.
+\endomit
+
+\section2 Related Information
+\list
+ \li \l{QML Coding Conventions}
+\endlist
+
+\section1 Bundle Application Resources
+
+Most applications depend on resources such as images and icons to provide a
+rich user experience. It can often be a challenge to make these resources
+available to the application regardless of the target OS. Most popular OS-es
+employ stricter security policies that restrict access to the file system,
+making it harder to load these resources. As an alternative, Qt offers its own
+resource system that is built into the application binary, enabling access to
+the application's resources regardless of the target OS.
+
+It is recommended to bundle your application's resources (including the
+\c .qml files) into a resource file (\c.qrc). For example, the following entry
+in the qmake project file ensures that the resources are built into the
+application binary, making them available when needed:
+
+\badcode
+ RESOURCES += resources.qrc
+\endcode
+
+If your application depends on a limited number of resources, you could list
+them directly in the project file.
+
+\badcode
+ RESOURCES += a.qml b.png
+\endcode
+
+In such a case, qmake creates the \c qmake_intermediate.qrc build artifact,
+which you could rename and use the \c{RESOURCES += resource-set.qrc} entry
+instead.
+
+You could go a step further by using one \c .qrc file for each resource type.
+For example, list the \c .qml files in \c files.qrc, images in
+\c images.qrc, fonts in \c fonts.qrc, and so on. That way, you need not
+recompile the QML files when you, for example, add an image to the list in
+\c images.qrc.
+
+\section2 Related Information
+\list
+ \li \l{The Qt Resource System}
+\endlist
+
+\section1 Application UI and Business Logic
+
+One of the key goals that most application developers want to achieve is to
+create a maintainable application. One of the ways to achieve this goal is
+to separate the UI from the business logic. The following are a few reasons
+why application's UI should be in QML:
+
+\list
+ \li QML is a declarative language, which suits best for defining UIs.
+ \li It's easier to embed JavaScript in QML to respond to events, for example.
+ \li QML is faster to code as it is not strongly typed.
+\endlist
+
+On the other hand, C++ being a strongly typed language, suits best for defining
+business logic. Typically, such code performs tasks such as complex calculations
+or larger data processing, which can be faster with C++ than with QML.
+
+Qt offers various approaches to integrate QML and C++ code in an application.
+In most cases, the C++ part (business logic) provides the data model to the QML
+part (UI), which presents it in a readable form. It is often a challenge to
+decide when to use this approach. It is recommended to use QML
+if the data model is static, simple, and small, as C++ could be overkill.
+Use C++ if the application depends on a dynamic, large, and complex data model.
+
+\omit
+examples snippets of simpler and complex data models.
+\endomit
+
+\section2 Interaction Path
+
+Although Qt enables you to manipulate QML from C++, it is not a recommended
+approach, as debugging such code can be painful. The QML engine works out
+a lot of the details on the fly, so manipulating the QML items from C++ could
+lead to unexpected results. This approach also makes the C++ code rely on the
+QML code to provide certain properties or objects, making it difficult to
+refactor the QML code without breaking the C++ code. Moreover, such C++ code
+cannot reused with other QML code. To avoid all of these hassles and have a
+maintainable application, it is recommended to always use the C++ to QML path
+and not the other way around.
+
+\section2 Related Information
+\list
+\li \l{Integrating QML and C++}
+\li \l{Chat Tutorial Example}
+\endlist
+
+\section1 Qt Quick Layouts
+
+Qt offers Qt Quick Layouts to arrange Qt Quick items visually in a layout.
+Unlike its alternative, the item positioners, the Qt Quick Layouts can also
+resize its children on window resize. Although Qt Quick Layouts are often
+the desired choice for most use cases, the following \e dos and \e{don'ts}
+must be considered while using them:
+
+\section2 Dos
+
+\list
+ \li Use anchors or the item's width and height properties to specify the size
+ of the layout against its parent.
+ \li Use the \l Layout attached property to set the size and alignment
+ attributes of the layout's immediate children.
+\endlist
+
+\section2 Don'ts
+
+\list
+ \li Do not rely on anchors to specify the preferred size of an item in a layout.
+ Instead, use \c Layout.preferredWidth and \c Layout.preferredHeight.
+ \li Do not define preferred sizes for items that provide implicitWidth and
+ implicitHeight, unless their implicit sizes are not satisfactory.
+ \li Do not mix anchors and layouts in ways that cause conflicts. For example,
+ do not apply anchor constraints to a layout's immediate children.
+
+ \snippet qml/windowconstraints.qml rowlayout
+\endlist
+
+\note Layouts and anchors are both types of objects that take more memory and
+instantiation time. Avoid using them (especially in list and table delegates,
+and styles for controls) when simple bindings to x, y, width, and height
+properties are enough.
+
+\section2 Related Information
+
+\list
+ \li \l{Item Positioners}
+ \li \l{Qt Quick Layouts Overview}
+\endlist
+*/
diff --git a/src/quick/doc/src/guidelines/qtquick-guidelines.qdoc b/src/quick/doc/src/guidelines/qtquick-guidelines.qdoc
new file mode 100644
index 0000000000..b8432fd9ca
--- /dev/null
+++ b/src/quick/doc/src/guidelines/qtquick-guidelines.qdoc
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 qtquick-guidelines.html
+\title Qt Quick Guidelines
+\brief Provides best practices and conventions for application developers
+
+Qt Quick has been the enabler that has helped developers achieve UI design
+goals faster and relieve from the monotony of imperative-coding. It is one of
+the very few UI design technologies that can be modified easily either using
+a text editor or a graphical designer tool.
+
+As an application developer, it is important to understand the limitations
+of any technology such as Qt Quick. This topic provides you the necessary insight
+into Qt Quick, and how it affects your application. It also provides pointers to best
+practices that you should try to follow, and the list of tools that helps you
+understand and improve your application.
+
+\list
+\li \l{Qt Quick Best practices}{Best Practices}
+\li \l{Qt Quick Tools and Utilities}
+\li \l{Performance Considerations And Suggestions}{Performance improvement tips}
+\li \l{Qt Quick Scene Graph}
+\endlist
+*/
diff --git a/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc
new file mode 100644
index 0000000000..9729b16392
--- /dev/null
+++ b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 qtquick-tools-and-utilities.html
+\title Qt Quick Tools and Utilities
+\brief Lists the tools and utilities that enhance developer experience
+
+Qt offers several tools and utilities to enable a rich developer experience,
+especially for Qt Quick developers. The following sections provide a brief
+introduction to those tools and utilities, and provide links to further
+information about them.
+
+\section1 Qt Quick Designer
+
+The Qt Quick Designer enables designing Qt Quick-based UIs using simple
+drag-n-drop gestures that most designers are familiar with. It offers UI
+elements from the Qt Quick and Qt Quick Controls 2 modules, as well as
+integration for custom UI elements.
+
+The following is a list of example applications that use UIs created by
+the Qt Quick Designer:
+
+\list
+ \li \l{Qt Quick Controls 2 - Contacts List}
+ \li \l{Qt Quick Controls 2 - Flat Style}
+\endlist
+
+\section2 QML Debugger and Profiler
+
+Being a declarative language, a piece of QML code provides minimal details
+about the entities defined. In such a scenario, the QML debugger is a very
+useful utility that enables:
+\list
+ \li debugging JavaScript functions,
+ \li executing JavaScript expressions,
+ \li and inspecting QML properties.
+\endlist
+
+Besides this, a QML profiler enables you to get necessary diagnostic information,
+allowing you to analyze the application code for performance issues. For
+example, too much JavaScript in each frame, long-running C++ functions, and
+so on.
+
+\section2 Related Information
+\list
+ \li \l{QML Debugger}
+ \li \l{QML Profiler}
+\endlist
+
+\section2 QmlLive, GammaRay, and Squish
+
+QmlLive is a 3rd party tool that offers a QML runtime capable of rendering
+changes to the code in realtime. It avoids the need to rebuild the
+application after every code change and install it on the target device.
+You can also extend it to build a custom runtime that suits your needs.
+
+GammaRay is a useful utility that provides diagnostic information
+about your application. It is similar to the QML Profiler described in the
+earlier section, but offers a lot more. For example, the number of items or
+QObjects created, function calls made, time taken by each function call,
+property value introspection at runtime, and so on. Such information is very
+handy, especially while debugging QML applications.
+
+Squish is a well-known testing tool that automates UI testing by recording
+your actions or running scripts. Once the tests are setup, UI tests are a lot
+easier to run.
+
+\section2 Related Information
+\list
+ \li \l{QmlLive}
+ \li \l{GammaRay}
+ \li \l{Squish}
+\endlist
+
+\section1 Qt Creator
+
+The Qt Creator IDE is the key tool that enhances the overall developer experience of
+working with Qt Quick. Its auto-completion and debugging features make working
+with Qt Quick easier. Besides this, most of the tools and utilities
+mentioned in the earlier sections are integrated into it, with the possibility of
+integrating 3rd party tools such as QmlLive and GammaRay.
+
+\section2 Related Information
+\list
+\li \l{Qt Creator Manual}
+\li \l{Qt Creator: Integrating 3rd Party Tools}
+\endlist
+*/
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index ece66cb589..4d8da5ed5a 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -118,6 +118,7 @@ Additional Qt Quick information:
\li \l{Qt Quick Test QML Types}{Tests} - contains types for writing unit test for a QML application
\endlist
\li \l{Qt Quick Examples and Tutorials}
+\li \l{Qt Quick Guidelines}
\endlist
Further information for writing QML applications:
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index dc473a6640..ce706d76f7 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -71,9 +71,9 @@ static inline QVector4D qsg_premultiply(const QVector4D &c, float globalOpacity)
return QVector4D(c.x() * o, c.y() * o, c.z() * o, o);
}
-static inline int qsg_device_pixel_ratio(QOpenGLContext *ctx)
+static inline qreal qsg_device_pixel_ratio(QOpenGLContext *ctx)
{
- int devicePixelRatio = 1;
+ qreal devicePixelRatio = 1;
if (ctx->surface()->surfaceClass() == QSurface::Window) {
QWindow *w = static_cast<QWindow *>(ctx->surface());
if (QQuickWindow *qw = qobject_cast<QQuickWindow *>(w))
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index c252bba001..a456facd2f 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -89,6 +89,7 @@ private slots:
void customValueType();
void customValueTypeInQml();
void gadgetInheritance();
+ void gadgetTemplateInheritance();
void toStringConversion();
void enumerableProperties();
void enumProperties();
@@ -1613,6 +1614,19 @@ public:
Q_INVOKABLE void functionInDerivedGadget(int value) { m_derivedProperty = value; }
};
+// QTBUG-66744: we want a Q_GADGET giving us generic type safety in C++ and property access in Qml
+template <typename T>
+struct DerivedTypedGadget : public BaseGadget
+{
+ // cannot use Q_GADGET here
+public:
+ DerivedTypedGadget() {}
+};
+
+class DerivedTypedGadgetDummyType {};
+
+Q_DECLARE_METATYPE(DerivedTypedGadget<DerivedTypedGadgetDummyType>)
+
class TypeWithCustomValueType : public QObject
{
Q_OBJECT
@@ -1657,6 +1671,21 @@ void tst_qqmlvaluetypes::gadgetInheritance()
QCOMPARE(value.property("baseProperty").toInt(), 42);
}
+void tst_qqmlvaluetypes::gadgetTemplateInheritance()
+{
+ QJSEngine engine;
+
+ QJSValue value = engine.toScriptValue(DerivedTypedGadget<DerivedTypedGadgetDummyType>());
+
+ QCOMPARE(value.property("baseProperty").toInt(), 0);
+ value.setProperty("baseProperty", 10);
+ QCOMPARE(value.property("baseProperty").toInt(), 10);
+
+ QJSValue method = value.property("functionInBaseGadget");
+ method.call(QJSValueList() << QJSValue(42));
+ QCOMPARE(value.property("baseProperty").toInt(), 42);
+}
+
struct StringLessGadget {
Q_GADGET
};
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 75e474ba70..1e87a2d7e7 100644
--- a/tools/qmlcachegen/qtquickcompiler.prf
+++ b/tools/qmlcachegen/qtquickcompiler.prf
@@ -22,21 +22,21 @@ QMLCACHE_RESOURCE_FILES =
for(res, RESOURCES) {
absRes = $$absolute_path($$res, $$_PRO_FILE_PWD_)
- rccContents = $$system($$QMAKE_RCC_DEP -list $$absRes,lines)
+ rccContents = $$system($$QMAKE_RCC_DEP -list $$system_quote($$absRes),lines)
contains(rccContents,.*\\.js$)|contains(rccContents,.*\\.qml$) {
new_resource = $$qmlCacheResourceFileOutputName($$res)
mkpath($$dirname(new_resource))
- remaining_files = $$system($$QML_CACHEGEN_FILTER -filter-resource-file -o $$new_resource $$absRes,lines)
+ remaining_files = $$system($$QML_CACHEGEN_FILTER -filter-resource-file -o $$system_quote($$new_resource) $$system_quote($$absRes),lines)
!isEmpty(remaining_files) {
NEWRESOURCES += $$new_resource
- QMLCACHE_LOADER_FLAGS += --resource-file-mapping=$$absRes=$$new_resource
+ QMLCACHE_LOADER_FLAGS += --resource-file-mapping=$$shell_quote($$absRes=$$new_resource)
} else {
- QMLCACHE_LOADER_FLAGS += --resource-file-mapping=$$absRes
+ QMLCACHE_LOADER_FLAGS += --resource-file-mapping=$$shell_quote($$absRes)
}
QMLCACHE_RESOURCE_FILES += $$absRes
- for(candidate, $$list($$rccContents)) {
+ for(candidate, rccContents) {
contains(candidate,.*\\.js$)|contains(candidate,.*\\.qml$) {
QMLCACHE_FILES += $$candidate
}
@@ -50,7 +50,7 @@ RESOURCES = $$NEWRESOURCES
QMLCACHE_RESOURCE_FLAGS =
for(res, QMLCACHE_RESOURCE_FILES) {
- QMLCACHE_RESOURCE_FLAGS += --resource=$$res
+ QMLCACHE_RESOURCE_FLAGS += --resource=$$shell_quote($$res)
}
defineReplace(qmlCacheOutputName) {