aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-10-03 14:55:01 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-10-03 14:55:01 +0300
commiteca36baf3d8c6c52509f487f75dc7c46bd63e73c (patch)
tree408acf2cc6d3227a82e2f2765bc6ad71e3bff5c7
parent4a6dfcd838a62ed7b3500326af6099c00a5cbf49 (diff)
parentb65d9135ebd43d5bf3cc882a94230a305893fd6a (diff)
Merge remote-tracking branch 'origin/tqtc/lts-6.2.7' into tqtc/lts-6.2-opensource
-rw-r--r--.cmake.conf2
-rw-r--r--.qmake.conf2
-rw-r--r--coin/module_config.yaml1
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc6
-rw-r--r--examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h2
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h6
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h6
-rw-r--r--examples/quick/keyinteraction/GridMenu.qml7
-rw-r--r--examples/quick/keyinteraction/ListViewDelegate.qml9
-rw-r--r--examples/quick/keyinteraction/TabMenu.qml7
-rw-r--r--examples/quick/keyinteraction/focus.qml35
-rw-r--r--examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/chapter1.pro5
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/chapter2.pro6
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/chapter3.pro6
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/chapter4.pro6
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/chapter5.pro6
-rw-r--r--examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc2
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.cpp69
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.h16
-rw-r--r--examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml3
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorPosix.cpp2
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/labs/animation/qquickboundaryrule.cpp2
-rw-r--r--src/labs/platform/qquicklabsplatformfolderdialog.cpp1
-rw-r--r--src/labs/platform/qquicklabsplatformmenubar.cpp1
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp4
-rw-r--r--src/qml/Qt6QmlMacros.cmake10
-rw-r--r--src/qml/common/qv4compileddata_p.h6
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp62
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h4
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc4
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc2
-rw-r--r--src/qml/jsapi/qjsvalue.cpp10
-rw-r--r--src/qml/jsruntime/qv4engine.cpp19
-rw-r--r--src/qml/jsruntime/qv4engine_p.h11
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp11
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4reflect.cpp5
-rw-r--r--src/qml/qml/qqmlcomponent.cpp10
-rw-r--r--src/qml/qml/qqmlincubator.cpp15
-rw-r--r--src/qml/qml/qqmlpropertycachecreator.cpp4
-rw-r--r--src/qml/qml/qqmlpropertycachecreator_p.h11
-rw-r--r--src/qml/qml/qqmlpropertydata_p.h1
-rw-r--r--src/qml/qml/qqmltypecompiler.cpp10
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp9
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp20
-rw-r--r--src/qmlmodels/qqmllistmodel.cpp10
-rw-r--r--src/qmltyperegistrar/qmltyperegistrar.cpp13
-rw-r--r--src/quick/handlers/qquickhoverhandler.cpp4
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp4
-rw-r--r--src/quick/handlers/qquickwheelhandler.cpp2
-rw-r--r--src/quick/items/qquickdrag.cpp12
-rw-r--r--src/quick/items/qquickdrag_p.h3
-rw-r--r--src/quick/items/qquickflickable.cpp13
-rw-r--r--src/quick/items/qquickflickable_p_p.h33
-rw-r--r--src/quick/items/qquickpainteditem.cpp2
-rw-r--r--src/quick/items/qquickpincharea.cpp4
-rw-r--r--src/quick/items/qquickrendercontrol.cpp2
-rw-r--r--src/quick/items/qquickshadereffect.cpp3
-rw-r--r--src/quick/items/qquicktableview.cpp38
-rw-r--r--src/quick/items/qquicktext.cpp34
-rw-r--r--src/quick/items/qquicktextedit.cpp3
-rw-r--r--src/quick/items/qquicktextinput.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp8
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp4
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h1
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/qsgrhishadereffectnode.cpp16
-rw-r--r--src/quick/scenegraph/qsgrhishadereffectnode_p.h2
-rw-r--r--src/quick/scenegraph/qsgrhitextureglyphcache.cpp5
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp3
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp113
-rw-r--r--src/quickcontrols2/doc/src/includes/qquicktooltip.qdocinc6
-rw-r--r--src/quickcontrols2/doc/src/qtquickcontrols2-customize.qdoc9
-rw-r--r--src/quickcontrols2/windows/SpinBox.qml11
-rw-r--r--src/quicklayouts/qquickgridlayoutengine.cpp7
-rw-r--r--src/quicklayouts/qquickgridlayoutengine_p.h1
-rw-r--r--src/quicklayouts/qquicklayout.cpp16
-rw-r--r--src/quicklayouts/qquicklayout_p.h2
-rw-r--r--src/quicklayouts/qquicklinearlayout.cpp1
-rw-r--r--src/quicklayouts/qquickstacklayout.cpp22
-rw-r--r--src/quicklayouts/qquickstacklayout_p.h2
-rw-r--r--src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm14
-rw-r--r--src/quicknativestyle/qstyle/qquickcommonstyle.cpp7
-rw-r--r--src/quickshapes/qquickshape.cpp8
-rw-r--r--src/quickshapes/qquickshapegenericrenderer.cpp8
-rw-r--r--src/quicktemplates2/qquickdialog_p.h2
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp24
-rw-r--r--src/quicktemplates2/qquickpopup.cpp6
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp3
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp9
-rw-r--r--src/quicktemplates2/qquickshortcutcontext.cpp19
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp3
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp5
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp5
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp2
-rw-r--r--src/quicktestutils/CMakeLists.txt1
-rw-r--r--tests/auto/qml/debugger/qv4debugger/CMakeLists.txt12
-rw-r--r--tests/auto/qml/debugger/qv4debugger/commontypes.h20
-rw-r--r--tests/auto/qml/debugger/qv4debugger/data/qtbug_107607.qml10
-rw-r--r--tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp55
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp17
-rw-r--r--tests/auto/qml/qmltyperegistrar/CMakeLists.txt10
-rw-r--r--tests/auto/qml/qqmlchangeset/CMakeLists.txt4
-rw-r--r--tests/auto/qml/qqmllanguage/data/ComponentType.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml21
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.15.qml21
-rw-r--r--tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml11
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml30
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp55
-rw-r--r--tests/auto/qml/qqmllocale/data/functions.qml3
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp12
-rw-r--r--tests/auto/qml/qqmltranslation/CMakeLists.txt1
-rw-r--r--tests/auto/qml/qqmltranslation/data/translatedElements.qml15
-rw-r--r--tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp39
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp47
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpinchhandler/data/nullTarget.qml33
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpinchhandler/data/pinchproperties.qml36
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp190
-rw-r--r--tests/auto/quick/qquickdeliveryagent/data/listViewDelegate.qml21
-rw-r--r--tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp27
-rw-r--r--tests/auto/quick/qquickdroparea/data/ignoreRetriggerEvent.qml15
-rw-r--r--tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp29
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp75
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml50
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml115
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml411
-rw-r--r--tests/auto/quick/qquickloader/data/overflow.qml5
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp13
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp56
-rw-r--r--tests/auto/quick/qquicktableview/data/syncviewsimple.qml26
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp117
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp40
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp53
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_popup.qml17
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_scrollview.qml37
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_stackview.qml22
-rw-r--r--tests/auto/quickcontrols2/controls/data/tst_tooltip.qml52
-rw-r--r--tests/auto/quickcontrols2/controls/imagine/BLACKLIST4
-rw-r--r--tests/auto/quickcontrols2/qquickimaginestyle/data/tst_imagine.qml4
-rw-r--r--tests/auto/quickcontrols2/qquickmenu/data/actionShortcuts.qml97
-rw-r--r--tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp56
-rw-r--r--tests/auto/quickcontrols2/qquickpopup/data/applicationwindow-wheel.qml9
-rw-r--r--tests/auto/quickcontrols2/qquickpopup/data/window-wheel.qml9
-rw-r--r--tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp20
-rw-r--r--tests/auto/quickdialogs/qquickfiledialogimpl/BLACKLIST4
-rw-r--r--tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml25
-rw-r--r--tests/benchmarks/qml/qqmlchangeset/CMakeLists.txt4
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt6
-rw-r--r--tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt6
-rw-r--r--tests/manual/pointer/pinchNullTarget.qml50
-rw-r--r--tests/manual/quickcontrols2/testbench/controls/Button.qml35
169 files changed, 2748 insertions, 444 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 6f32ba4d52..07d90b8adc 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1,2 +1,2 @@
-set(QT_REPO_MODULE_VERSION "6.2.6")
+set(QT_REPO_MODULE_VERSION "6.2.7")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "")
diff --git a/.qmake.conf b/.qmake.conf
index ddbb4b65f7..1a33c704d2 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ DEFINES += QT_NO_JAVA_STYLE_ITERATORS
QQC2_SOURCE_TREE = $$PWD
-MODULE_VERSION = 6.2.6
+MODULE_VERSION = 6.2.7
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
index 2b324459ef..e1d12d4464 100644
--- a/coin/module_config.yaml
+++ b/coin/module_config.yaml
@@ -1,4 +1,5 @@
version: 2
+alias: qtdeclarative
accept_configuration:
condition: property
property: features
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index 310436759e..36d7ee290c 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -264,6 +264,12 @@ This example builds on:
\brief Attached Properties.
\ingroup qmlextendingexamples
+This example demonstrates how to create custom
+\l {Attached Properties and Attached Signal Handlers} {attached properties}.
+For a more in-depth description on how one can create attached properties,
+see \l {Providing Attached Properties}.
+
+
This example builds on:
\list
\li \l {Extending QML - Grouped Properties Example}
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
index c04b465254..146ba6c887 100644
--- a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter1-basics
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter1-basics
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
index 687f8e2b4d..742f8ec0fd 100644
--- a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
@@ -57,8 +57,8 @@
class PieChart : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
index 993c235965..c5e066cad0 100644
--- a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter2-methods
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter2-methods
diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
index 271afbf653..6457a8561d 100644
--- a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
@@ -58,8 +58,8 @@ class PieChart : public QQuickPaintedItem
{
//![0]
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
//![1]
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
index f600ae5389..184f440c1d 100644
--- a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter3-bindings
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter3-bindings
diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
index 58b1339298..ef3f6a79dc 100644
--- a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
@@ -58,11 +58,11 @@ class PieChart : public QQuickPaintedItem
{
//![0]
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
//![1]
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
public:
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
index 50e231bb7d..51855394e3 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
@@ -41,6 +41,7 @@ qt_add_qml_module(chapter4-customPropertyTypes
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter4-customPropertyTypes
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
index 855ad7ae3a..57ef7d90e2 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
@@ -58,9 +58,9 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice)
+ Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice FINAL)
//![0]
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
Q_MOC_INCLUDE("pieslice.h")
QML_ELEMENT
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
index 6e64917851..84d1789e56 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
@@ -57,7 +57,7 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
index 1891bc34d5..ac3f7839ab 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
@@ -41,6 +41,7 @@ qt_add_qml_module(chapter5-listproperties
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter5-listproperties
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
index 236fa6796f..3caa80ed53 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
@@ -58,9 +58,9 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL)
//![0]
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
index 0b290851f0..50c573c7bc 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
@@ -57,9 +57,9 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
- Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL)
QML_ELEMENT
//![0]
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
index 101fcb036b..62d4c71fc4 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
@@ -2,6 +2,7 @@ qt6_add_qml_module(chartsplugin
VERSION 1.0
URI "Charts"
PLUGIN_TARGET chartsplugin
+ DEPENDENCIES QtQuick
)
target_sources(chartsplugin PRIVATE
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
index e6b768b274..d48f217ea4 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
@@ -57,8 +57,8 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
index 091870bd51..965b50f058 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
@@ -56,9 +56,9 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
- Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL)
QML_ELEMENT
public:
diff --git a/examples/quick/keyinteraction/GridMenu.qml b/examples/quick/keyinteraction/GridMenu.qml
index 4b05785e1d..d5914fe4d6 100644
--- a/examples/quick/keyinteraction/GridMenu.qml
+++ b/examples/quick/keyinteraction/GridMenu.qml
@@ -105,12 +105,7 @@ FocusScope {
states: State {
name: "active"; when: container.activeFocus
- PropertyChanges {
- content {
- color: "#FCFFF5"
- scale: 1.1
- }
- }
+ PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 }
}
transitions: Transition {
diff --git a/examples/quick/keyinteraction/ListViewDelegate.qml b/examples/quick/keyinteraction/ListViewDelegate.qml
index 9fe4949282..1d14f22195 100644
--- a/examples/quick/keyinteraction/ListViewDelegate.qml
+++ b/examples/quick/keyinteraction/ListViewDelegate.qml
@@ -87,13 +87,8 @@ Item {
states: State {
name: "active"; when: container.activeFocus
- PropertyChanges {
- content {
- color: "#FCFFF5"
- scale: 1.1
- }
- label.font.pixelSize: 16
- }
+ PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 }
+ PropertyChanges { target: label; font.pixelSize: 16 }
}
transitions: Transition {
diff --git a/examples/quick/keyinteraction/TabMenu.qml b/examples/quick/keyinteraction/TabMenu.qml
index 7aa70a7dcb..cfa38e958c 100644
--- a/examples/quick/keyinteraction/TabMenu.qml
+++ b/examples/quick/keyinteraction/TabMenu.qml
@@ -100,12 +100,7 @@ FocusScope {
states: State {
name: "active"; when: container.activeFocus
- PropertyChanges {
- content {
- color: "#FCFFF5"
- scale: 1.1
- }
- }
+ PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 }
}
transitions: Transition {
diff --git a/examples/quick/keyinteraction/focus.qml b/examples/quick/keyinteraction/focus.qml
index 1eef9b9981..7b1452ba35 100644
--- a/examples/quick/keyinteraction/focus.qml
+++ b/examples/quick/keyinteraction/focus.qml
@@ -118,29 +118,23 @@ Rectangle {
states: [
State {
name: "showTabViews"
- PropertyChanges {
- tabMenu.y: 160
- gridMenu.y: 320
- listMenu.y: 640
- }
+ PropertyChanges { target: tabMenu; y: 160 }
+ PropertyChanges { target: gridMenu; y: 320 }
+ PropertyChanges { target: listMenu; y: 640 }
},
State {
name: "showGridViews"
- PropertyChanges {
- tabMenu.y: 0
- gridMenu.y: 160
- listMenu.y: 480
- }
+ PropertyChanges { target: tabMenu; y: 0 }
+ PropertyChanges { target: gridMenu; y: 160 }
+ PropertyChanges { target: listMenu; y: 480 }
},
State {
name: "showListViews"
- PropertyChanges {
- tabMenu.y: -160
- gridMenu.y: 0
- listMenu.y: 320
- }
+ PropertyChanges { target: tabMenu; y: -160 }
+ PropertyChanges { target: gridMenu; y: 0 }
+ PropertyChanges { target: listMenu; y: 320 }
}
]
@@ -171,14 +165,9 @@ Rectangle {
states: State {
name: "contextMenuOpen"
when: !mainView.activeFocus
- PropertyChanges {
- contextMenu {
- x: 0
- open: true
- }
- mainView.x: 130
- shade.opacity: 0.25
- }
+ PropertyChanges { target: contextMenu; x: 0; open: true }
+ PropertyChanges { target: mainView; x: 130 }
+ PropertyChanges { target: shade; opacity: 0.25 }
}
transitions: Transition {
diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
index 60167aa813..228dc4b56f 100644
--- a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
+++ b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
@@ -63,7 +63,7 @@ Rectangle {
Rectangle {
id: content
- anchors { left: parent.left; right: parent.right }
+ width: ListView.view.width
height: column.implicitHeight + 4
border.width: 1
diff --git a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro
index 221bb855f5..6b50809f20 100644
--- a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro
+++ b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro
@@ -5,8 +5,9 @@ CONFIG += c++11
SOURCES += main.cpp
-RESOURCES += \
- main.qml \
+resources.files = main.qml
+resources.prefix = chapter1/
+RESOURCES += resources \
qtquickcontrols2.conf
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1
diff --git a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro
index e217934b7e..15429b7c89 100644
--- a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro
+++ b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro
@@ -5,7 +5,7 @@ CONFIG += c++11
SOURCES += main.cpp
-RESOURCES += \
+resources.files = \
images/Albert_Einstein.png \
images/Albert_Einstein@2x.png \
images/Albert_Einstein@3x.png \
@@ -18,7 +18,9 @@ RESOURCES += \
images/Hans_Gude@2x.png \
images/Hans_Gude@3x.png \
images/Hans_Gude@4x.png \
- main.qml \
+ main.qml
+resources.prefix = chapter2/
+RESOURCES += resources \
qtquickcontrols2.conf
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2
diff --git a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro
index a5e500d9db..42adc69fe9 100644
--- a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro
+++ b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro
@@ -5,7 +5,7 @@ CONFIG += c++11
SOURCES += main.cpp
-RESOURCES += \
+resources.files = \
ContactPage.qml \
ConversationPage.qml \
images/Albert_Einstein.png \
@@ -20,7 +20,9 @@ RESOURCES += \
images/Hans_Gude@2x.png \
images/Hans_Gude@3x.png \
images/Hans_Gude@4x.png \
- main.qml \
+ main.qml
+resources.prefix = chapter3/
+RESOURCES += resources \
qtquickcontrols2.conf
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3
diff --git a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro
index dd2241355b..ae8141f7f1 100644
--- a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro
+++ b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro
@@ -10,7 +10,7 @@ SOURCES += main.cpp \
sqlcontactmodel.cpp \
sqlconversationmodel.cpp
-RESOURCES += \
+resources.files = \
ContactPage.qml \
ConversationPage.qml \
images/Albert_Einstein.png \
@@ -25,7 +25,9 @@ RESOURCES += \
images/Hans_Gude@2x.png \
images/Hans_Gude@3x.png \
images/Hans_Gude@4x.png \
- main.qml \
+ main.qml
+resources.prefix = chapter4/
+RESOURCES += resources \
qtquickcontrols2.conf
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4
diff --git a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro
index 1ca8998427..625642d7b5 100644
--- a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro
+++ b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro
@@ -10,7 +10,7 @@ SOURCES += main.cpp \
sqlcontactmodel.cpp \
sqlconversationmodel.cpp
-RESOURCES += \
+resources.files = \
+Material/ChatToolBar.qml \
ChatToolBar.qml \
ContactPage.qml \
@@ -27,7 +27,9 @@ RESOURCES += \
images/Hans_Gude@2x.png \
images/Hans_Gude@3x.png \
images/Hans_Gude@4x.png \
- main.qml \
+ main.qml
+resources.prefix = chapter5/
+RESOURCES += resources \
qtquickcontrols2.conf
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5
diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
index 5d9cab68c7..e457a414b1 100644
--- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
+++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
@@ -203,7 +203,7 @@ project.
The \c SOURCES variable lists all of the source files that should be compiled.
A similar variable, \c HEADERS, is available for header files.
-\printline RESOURCES
+\printuntil qtquickcontrols2
The next line tells \c qmake that we have a collection of
\l {The Qt Resource System}{resources} that should be built into the
diff --git a/examples/quickcontrols2/texteditor/documenthandler.cpp b/examples/quickcontrols2/texteditor/documenthandler.cpp
index d904e6f637..b266bc5694 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.cpp
+++ b/examples/quickcontrols2/texteditor/documenthandler.cpp
@@ -323,4 +323,73 @@ void DocumentHandler::setFont(const QFont & font){
emit fontChanged();
}
+bool DocumentHandler::bold() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().bold();
+ return cursor.charFormat().font().bold();
+}
+
+void DocumentHandler::setBold(bool bold)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().bold() == bold)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setBold(bold);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit boldChanged();
+}
+
+bool DocumentHandler::underline() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().underline();
+ return cursor.charFormat().font().underline();
+}
+
+void DocumentHandler::setUnderline(bool underline)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().underline() == underline)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setUnderline(underline);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit underlineChanged();
+}
+
+bool DocumentHandler::italic() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().italic();
+ return cursor.charFormat().font().italic();
+}
+
+void DocumentHandler::setItalic(bool italic)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().italic() == italic)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setItalic(italic);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit italicChanged();
+}
+
#include "moc_documenthandler.cpp"
diff --git a/examples/quickcontrols2/texteditor/documenthandler.h b/examples/quickcontrols2/texteditor/documenthandler.h
index 66b5957a20..aa3f257558 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.h
+++ b/examples/quickcontrols2/texteditor/documenthandler.h
@@ -75,6 +75,10 @@ class DocumentHandler : public QObject
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+ Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged)
+ Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged)
+ Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged)
+
Q_PROPERTY(QString fileName READ fileName NOTIFY fileUrlChanged)
Q_PROPERTY(QString fileType READ fileType NOTIFY fileUrlChanged)
Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY fileUrlChanged)
@@ -105,6 +109,15 @@ public:
QFont font() const;
void setFont(const QFont & font);
+ bool bold() const;
+ void setBold(bool bold);
+
+ bool underline() const;
+ void setUnderline(bool underline);
+
+ bool italic() const;
+ void setItalic(bool italic);
+
QString fileName() const;
QString fileType() const;
QUrl fileUrl() const;
@@ -123,6 +136,9 @@ Q_SIGNALS:
void selectionEndChanged();
void fontChanged();
+ void boldChanged();
+ void underlineChanged();
+ void italicChanged();
void textColorChanged();
void alignmentChanged();
diff --git a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
index 7d7554f44b..677d25fbd9 100644
--- a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
+++ b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
@@ -149,9 +149,6 @@ ApplicationWindow {
footer: ToolBar {
visible: !textArea.readOnly && textArea.activeFocus
- Material.primary: "#E0E0E0"
- Material.elevation: 0
-
Flickable {
anchors.fill: parent
contentWidth: toolRow.implicitWidth
diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
index e2f2454528..d799f913a4 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
@@ -228,7 +228,7 @@ void OSAllocator::commit(void* address, size_t bytes, bool writable, bool execut
while (madvise(address, bytes, MADV_WILLNEED)) {
if (errno != EAGAIN)
- CRASH();
+ break; // We don't have to crash here. MADV_WILLNEED is only advisory
}
#elif HAVE(MADV_FREE_REUSE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ab9b064390..1f82b16a62 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,8 +28,8 @@ if(TARGET Qt::Gui AND TARGET Qt::qsb AND QT_FEATURE_qml_animation)
add_subdirectory(quickshapes)
add_subdirectory(quicklayouts)
- find_package(Qt6 ${PROJECT_VERSION} CONFIG COMPONENTS Test) # special case
- if(QT_FEATURE_testlib AND TARGET Qt::Test) # special case
+ find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Test)
+ if(QT_FEATURE_testlib AND TARGET Qt::Test)
add_subdirectory(qmltest)
add_subdirectory(quicktestutils)
endif()
@@ -48,7 +48,7 @@ if(TARGET Qt::Gui AND TARGET Qt::qsb AND QT_FEATURE_qml_animation)
add_subdirectory(quickdialogs2)
add_subdirectory(quicknativestyle)
- if(TARGET Qt::QuickControls2)
+ if(QT_FEATURE_testlib AND TARGET Qt::Test AND TARGET Qt::QuickControls2)
add_subdirectory(quickcontrolstestutils)
endif()
else()
diff --git a/src/labs/animation/qquickboundaryrule.cpp b/src/labs/animation/qquickboundaryrule.cpp
index 61e5d007d5..161909b078 100644
--- a/src/labs/animation/qquickboundaryrule.cpp
+++ b/src/labs/animation/qquickboundaryrule.cpp
@@ -353,7 +353,7 @@ qreal QQuickBoundaryRule::peakOvershoot() const
}
/*!
- \qmlproperty enum QtQuick::BoundaryRule::overshootFilter
+ \qmlproperty enumeration QtQuick::BoundaryRule::overshootFilter
This property specifies the aggregation function that will be applied to
the intercepted property value.
diff --git a/src/labs/platform/qquicklabsplatformfolderdialog.cpp b/src/labs/platform/qquicklabsplatformfolderdialog.cpp
index f3d767bbe1..83e615e5b8 100644
--- a/src/labs/platform/qquicklabsplatformfolderdialog.cpp
+++ b/src/labs/platform/qquicklabsplatformfolderdialog.cpp
@@ -124,7 +124,6 @@ void QQuickLabsPlatformFolderDialog::setFolder(const QUrl &folder)
return;
m_folder = folder;
- setCurrentFolder(folder);
emit folderChanged();
}
diff --git a/src/labs/platform/qquicklabsplatformmenubar.cpp b/src/labs/platform/qquicklabsplatformmenubar.cpp
index 3c425b1164..0ebc699008 100644
--- a/src/labs/platform/qquicklabsplatformmenubar.cpp
+++ b/src/labs/platform/qquicklabsplatformmenubar.cpp
@@ -96,6 +96,7 @@ QT_BEGIN_NAMESPACE
\li macOS
\li Android
\li Linux (only available on desktop environments that provide a global D-Bus menu bar)
+ \li Windows
\endlist
\labs
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
index e0c24979a9..381f09742a 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
@@ -211,8 +211,8 @@ void ValueLookupJob::run()
QScopedPointer<QObject> scopeObject;
QV4::ExecutionEngine *engine = collector->engine();
QV4::Scope scope(engine);
- QV4::Heap::ExecutionContext *qmlContext = nullptr;
- if (engine->qmlEngine() && !engine->qmlContext()) {
+ QV4::Heap::ExecutionContext *qmlContext = engine->qmlContext();
+ if (engine->qmlEngine() && !qmlContext) {
scopeObject.reset(new QObject);
qmlContext = QV4::QmlContext::create(engine->currentContext(),
QQmlContextData::get(engine->qmlEngine()->rootContext()),
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index d26f183f5d..bda7b9b83a 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -1810,6 +1810,11 @@ function(_qt_internal_qml_type_registration target)
if (TARGET ${target}Private)
list(APPEND cmd_args --private-includes)
+ else()
+ string(REGEX MATCH "Private$" privateSuffix ${target})
+ if (privateSuffix)
+ list(APPEND cmd_args --private-includes)
+ endif()
endif()
get_target_property(target_metatypes_json_file ${target} INTERFACE_QT_META_TYPES_BUILD_FILE)
@@ -2043,9 +2048,8 @@ but this file does not exist. Possible reasons include:
-cmake-output
)
get_target_property(qml_import_path ${target} QT_QML_IMPORT_PATH)
-
- if (qml_import_path)
- list(APPEND cmd_args ${qml_import_path})
+ if(qml_import_path)
+ list(APPEND qml_import_paths ${qml_import_path})
endif()
# Facilitate self-import so we can find the qmldir file
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h
index 3f33743ecf..8b2d5066c6 100644
--- a/src/qml/common/qv4compileddata_p.h
+++ b/src/qml/common/qv4compileddata_p.h
@@ -79,7 +79,11 @@ QT_BEGIN_NAMESPACE
// Also change the comment behind the number to describe the latest change. This has the added
// benefit that if another patch changes the version too, it will result in a merge conflict, and
// not get removed silently.
-#define QV4_DATA_STRUCTURE_VERSION 0x34 // added a flag to mark functions as closure wrappers
+
+// Note: We got two different versions 0x36 now, one with builtin value types and one without.
+// However, the one without is exclusive to Qt 6.4+ and the compiled data cannot be preserved
+// across Qt versions. Therefore, this is fine.
+#define QV4_DATA_STRUCTURE_VERSION 0x36 // reordered runtime functions when compiling at run time
class QIODevice;
class QQmlTypeNameCache;
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 1ac2c4c7e3..9739c936da 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1984,61 +1984,23 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
return runtimeFunctionIndices;
}
-bool JSCodeGen::generateCodeForComponents(const QVector<quint32> &componentRoots)
+bool JSCodeGen::generateRuntimeFunctions(QmlIR::Object *object)
{
- for (int i = 0; i < componentRoots.count(); ++i) {
- if (!compileComponent(componentRoots.at(i)))
- return false;
- }
-
- return compileComponent(/*root object*/0);
-}
-
-bool JSCodeGen::compileComponent(int contextObject)
-{
- const QmlIR::Object *obj = document->objects.at(contextObject);
- if (obj->flags & QV4::CompiledData::Object::IsComponent && !obj->isInlineComponent) {
- Q_ASSERT(obj->bindingCount() == 1);
- const QV4::CompiledData::Binding *componentBinding = obj->firstBinding();
- Q_ASSERT(componentBinding->type() == QV4::CompiledData::Binding::Type_Object);
- contextObject = componentBinding->value.objectIndex;
- }
-
- return compileJavaScriptCodeInObjectsRecursively(contextObject, contextObject);
-}
-
-bool JSCodeGen::compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex)
-{
- QmlIR::Object *object = document->objects.at(objectIndex);
- if (object->flags & QV4::CompiledData::Object::IsComponent && !object->isInlineComponent)
+ if (object->functionsAndExpressions->count == 0)
return true;
- for (auto it = object->inlineComponentsBegin(); it != object->inlineComponentsEnd(); ++it)
- compileComponent(it->objectIndex);
-
- if (object->functionsAndExpressions->count > 0) {
- QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile;
- for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next)
- functionsToCompile << *foe;
- const QVector<int> runtimeFunctionIndices = generateJSCodeForFunctionsAndBindings(functionsToCompile);
- if (hasError())
- return false;
-
- object->runtimeFunctionIndices.allocate(document->jsParserEngine.pool(),
- runtimeFunctionIndices);
+ QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile;
+ functionsToCompile.reserve(object->functionsAndExpressions->count);
+ for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe;
+ foe = foe->next) {
+ functionsToCompile << *foe;
}
- for (const QmlIR::Binding *binding = object->firstBinding(); binding; binding = binding->next) {
- const Binding::Type bindingType = binding->type();
- if (bindingType < QV4::CompiledData::Binding::Type_Object)
- continue;
-
- int target = binding->value.objectIndex;
- int scope = bindingType == QV4::CompiledData::Binding::Type_Object ? target : scopeObjectIndex;
-
- if (!compileJavaScriptCodeInObjectsRecursively(binding->value.objectIndex, scope))
- return false;
- }
+ const auto runtimeFunctionIndices = generateJSCodeForFunctionsAndBindings(functionsToCompile);
+ if (hasError())
+ return false;
+ object->runtimeFunctionIndices.allocate(document->jsParserEngine.pool(),
+ runtimeFunctionIndices);
return true;
}
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 9342e0f178..93e550a530 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -595,9 +595,7 @@ struct Q_QMLCOMPILER_PRIVATE_EXPORT JSCodeGen : public QV4::Compiler::Codegen
// Returns mapping from input functions to index in IR::Module::functions / compiledData->runtimeFunctions
QVector<int> generateJSCodeForFunctionsAndBindings(const QList<CompiledFunctionOrExpression> &functions);
- bool generateCodeForComponents(const QVector<quint32> &componentRoots);
- bool compileComponent(int contextObject);
- bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex);
+ bool generateRuntimeFunctions(QmlIR::Object *object);
private:
Document *document;
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 6760f87dc7..cc4f4a2747 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -284,7 +284,7 @@
// Initialize this using myObject where you would previously
// call qmlRegisterSingletonInstance().
- static MySingleton *s_singletonInstance = nullptr;
+ inline static MySingleton *s_singletonInstance = nullptr;
static MySingleton *create(QQmlEngine *, QJSEngine *engine)
{
@@ -308,7 +308,7 @@
}
private:
- static QJSEngine *s_engine = nullptr;
+ inline static QJSEngine *s_engine = nullptr;
};
\endcode
diff --git a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
index be1908f7cd..4d7ea272ce 100644
--- a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
@@ -443,7 +443,7 @@ documentation on this, no further action is needed. qmltyperegistrar will
automatically generate the \c .qmltypes files.
Example:
-If your module is in \c /tmp/imports/My/Module, a file caled \c plugins.qmltypes
+If your module is in \c /tmp/imports/My/Module, a file called \c plugins.qmltypes
should be generated alongside the actual plugin binary.
Add the line
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 03cd1e9aa9..832eaca8da 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -142,6 +142,16 @@
integers.append(jsArray.property(i).toInt());
}
\endcode
+
+ \section2 Converting to JSON
+
+ It's possible to convert a QJSValue to a JSON type. For example,
+ to convert to an array, use \l QJSEngine::fromScriptValue():
+
+ \code
+ const QJsonValue jsonValue = engine.fromScriptValue<QJsonValue>(jsValue);
+ const QJsonArray jsonArray = jsonValue.toArray();
+ \endcode
*/
/*!
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 8eb7d8982d..f47ce4f825 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -2005,6 +2005,25 @@ int ExecutionEngine::maxGCStackSize() const
return m_maxGCStackSize;
}
+/*!
+ \internal
+ Returns \a length converted to int if its safe to
+ pass to \c Scope::alloc.
+ Otherwise it throws a RangeError, and returns 0.
+ */
+int ExecutionEngine::safeForAllocLength(qint64 len64)
+{
+ if (len64 < 0ll || len64 > qint64(std::numeric_limits<int>::max())) {
+ this->throwRangeError(QStringLiteral("Invalid array length."));
+ return 0;
+ }
+ if (len64 > qint64(this->jsStackLimit - this->jsStackTop)) {
+ this->throwRangeError(QStringLiteral("Array too large for apply()."));
+ return 0;
+ }
+ return len64;
+}
+
ReturnedValue ExecutionEngine::global()
{
return globalObject->asReturnedValue();
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index db6bfcc84b..0d3b279377 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -694,6 +694,7 @@ public:
int maxGCStackSize() const;
bool checkStackLimits();
+ int safeForAllocLength(qint64 len64);
bool canJIT(Function *f = nullptr)
{
@@ -778,6 +779,9 @@ public:
int argc, void **args, QMetaType *types);
private:
+ template<int Frames>
+ friend struct ExecutionEngineCallDepthRecorder;
+
QV4::ReturnedValue fromData(
const QMetaType &type, const void *ptr, const QVariant *variant = nullptr);
@@ -813,12 +817,15 @@ private:
#define CHECK_STACK_LIMITS(v4) if ((v4)->checkStackLimits()) return Encode::undefined(); \
ExecutionEngineCallDepthRecorder _executionEngineCallDepthRecorder(v4);
+template<int Frames = 1>
struct ExecutionEngineCallDepthRecorder
{
ExecutionEngine *ee;
- ExecutionEngineCallDepthRecorder(ExecutionEngine *e): ee(e) { ++ee->callDepth; }
- ~ExecutionEngineCallDepthRecorder() { --ee->callDepth; }
+ ExecutionEngineCallDepthRecorder(ExecutionEngine *e): ee(e) { ee->callDepth += Frames; }
+ ~ExecutionEngineCallDepthRecorder() { ee->callDepth -= Frames; }
+
+ bool hasOverflow() const { return ee->callDepth >= ExecutionEngine::maxCallDepth; }
};
inline bool ExecutionEngine::checkStackLimits()
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index d3bafbe055..798cfc131d 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -387,15 +387,10 @@ ReturnedValue FunctionPrototype::method_apply(const QV4::FunctionObject *b, cons
if (!arr)
return v4->throwTypeError();
- const qint64 len64 = arr->getLength();
- if (len64 < 0ll || len64 > qint64(std::numeric_limits<int>::max()))
- return v4->throwRangeError(QStringLiteral("Invalid array length."));
- if (len64 > qint64(v4->jsStackLimit - v4->jsStackTop))
- return v4->throwRangeError(QStringLiteral("Array too large for apply()."));
-
- const uint len = uint(len64);
-
Scope scope(v4);
+ const uint len = v4->safeForAllocLength(arr->getLength());
+ CHECK_EXCEPTION();
+
Value *arguments = scope.alloc<Scope::Uninitialized>(len);
if (len) {
if (ArgumentsObject::isNonStrictArgumentsObject(arr) && !arr->cast<ArgumentsObject>()->fullyCreated()) {
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 994d9a79a0..ad9760bfd6 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -665,7 +665,7 @@ public:
bool foundProblem() const { return m_callDepthRecorder.ee->hasException; }
private:
- ExecutionEngineCallDepthRecorder m_callDepthRecorder;
+ ExecutionEngineCallDepthRecorder<1> m_callDepthRecorder;
};
static QString quote(const QString &str)
diff --git a/src/qml/jsruntime/qv4reflect.cpp b/src/qml/jsruntime/qv4reflect.cpp
index 2a6c61f044..39a0b03dec 100644
--- a/src/qml/jsruntime/qv4reflect.cpp
+++ b/src/qml/jsruntime/qv4reflect.cpp
@@ -76,7 +76,10 @@ struct CallArgs {
static CallArgs createListFromArrayLike(Scope &scope, const Object *o)
{
- int len = o->getLength();
+ int len = scope.engine->safeForAllocLength(o->getLength());
+ if (scope.engine->hasException)
+ return {nullptr, 0};
+
Value *arguments = scope.alloc(len);
for (int i = 0; i < len; ++i) {
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 064eddc76a..80f8c88973 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1422,10 +1422,18 @@ void QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine *engine, QV
break;
}
}
- if (engine->hasException || !object) {
+ if (engine->hasException) {
qmlWarning(createdComponent, engine->catchExceptionAsQmlError());
continue;
}
+ if (!object) {
+ QQmlError error;
+ error.setUrl(qmlContext ? qmlContext->qmlContext()->url() : QUrl());
+ error.setDescription(QLatin1String("Cannot resolve property \"%1\".")
+ .arg(properties.join(u'.')));
+ qmlWarning(createdComponent, error);
+ continue;
+ }
name = engine->newString(properties.last());
object->put(name, val);
if (engine->hasException) {
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 7d4ffcec3f..59f4bf296e 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -269,6 +269,7 @@ void QQmlIncubatorPrivate::forceCompletion(QQmlInstantiationInterrupt &i)
}
}
+
void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
{
if (!compilationUnit)
@@ -280,6 +281,20 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
// get a copy of the engine pointer as it might get reset;
QQmlEnginePrivate *enginePriv = this->enginePriv;
+ // Incubating objects takes quite a bit more stack space than our usual V4 function
+ enum { EstimatedSizeInV4Frames = 2 };
+ QV4::ExecutionEngineCallDepthRecorder<EstimatedSizeInV4Frames> callDepthRecorder(
+ compilationUnit->engine);
+ if (callDepthRecorder.hasOverflow()) {
+ QQmlError error;
+ error.setMessageType(QtCriticalMsg);
+ error.setUrl(compilationUnit->url());
+ error.setDescription(QQmlComponent::tr("Maximum call stack size exceeded."));
+ errors << error;
+ progress = QQmlIncubatorPrivate::Completed;
+ goto finishIncubate;
+ }
+
if (!vmeGuard.isOK()) {
QQmlError error;
error.setMessageType(QtInfoMsg);
diff --git a/src/qml/qml/qqmlpropertycachecreator.cpp b/src/qml/qml/qqmlpropertycachecreator.cpp
index 5c88761d78..f6bedc94e9 100644
--- a/src/qml/qml/qqmlpropertycachecreator.cpp
+++ b/src/qml/qml/qqmlpropertycachecreator.cpp
@@ -115,8 +115,10 @@ bool QQmlBindingInstantiationContext::resolveInstantiatingProperty()
return true;
}
+ if (!referencingObjectPropertyCache)
+ return false;
+
Q_ASSERT(referencingObjectIndex >= 0);
- Q_ASSERT(referencingObjectPropertyCache);
Q_ASSERT(instantiatingBinding->propertyNameIndex != 0);
bool notInRevision = false;
diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h
index f4845ec27b..c415b5f33a 100644
--- a/src/qml/qml/qqmlpropertycachecreator_p.h
+++ b/src/qml/qml/qqmlpropertycachecreator_p.h
@@ -703,8 +703,15 @@ inline QMetaType QQmlPropertyCacheCreator<ObjectContainer>::metaTypeForParameter
QQmlType::AnyRegistrationType, &selfReference))
return QMetaType();
- if (!qmltype.isComposite())
- return qmltype.typeId();
+ if (!qmltype.isComposite()) {
+ const QMetaType typeId = qmltype.typeId();
+ if (!typeId.isValid() && qmltype.isInlineComponentType()) {
+ const int objectId = qmltype.inlineComponentId();
+ return objectContainer->typeIdsForComponent(objectId).id;
+ } else {
+ return typeId;
+ }
+ }
if (selfReference)
return objectContainer->typeIdsForComponent().id;
diff --git a/src/qml/qml/qqmlpropertydata_p.h b/src/qml/qml/qqmlpropertydata_p.h
index edf777ff18..1fbf24a1a7 100644
--- a/src/qml/qml/qqmlpropertydata_p.h
+++ b/src/qml/qml/qqmlpropertydata_p.h
@@ -281,7 +281,6 @@ public:
{
Q_ASSERT(idx >= std::numeric_limits<qint16>::min());
Q_ASSERT(idx <= std::numeric_limits<qint16>::max());
- Q_ASSERT(idx != m_coreIndex);
m_overrideIndex = qint16(idx);
}
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp
index ca1ed72a7f..d72fdb4d5c 100644
--- a/src/qml/qml/qqmltypecompiler.cpp
+++ b/src/qml/qml/qqmltypecompiler.cpp
@@ -151,11 +151,13 @@ QQmlRefPointer<QV4::ExecutableCompilationUnit> QQmlTypeCompiler::compile()
document->jsModule.fileName = typeData->urlString();
document->jsModule.finalUrl = typeData->finalUrlString();
QmlIR::JSCodeGen v4CodeGenerator(document, engine->v4engine()->illegalNames());
- if (!v4CodeGenerator.generateCodeForComponents(componentRoots())) {
- recordError(v4CodeGenerator.error());
- return nullptr;
+ for (QmlIR::Object *object : qAsConst(document->objects)) {
+ if (!v4CodeGenerator.generateRuntimeFunctions(object)) {
+ Q_ASSERT(v4CodeGenerator.hasError());
+ recordError(v4CodeGenerator.error());
+ return nullptr;
+ }
}
-
document->javaScriptCompilationUnit = v4CodeGenerator.generateCompilationUnit(/*generated unit data*/false);
}
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index cbf28c6f2b..b6f68536ca 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -240,13 +240,14 @@ void QQmlVMEMetaObjectEndpoint::tryConnect()
if (!target)
return;
- QQmlData *targetDData = QQmlData::get(target, /*create*/false);
- if (!targetDData)
- return;
QQmlPropertyIndex encodedIndex = QQmlPropertyIndex::fromEncoded(aliasData->encodedMetaPropertyIndex);
int coreIndex = encodedIndex.coreIndex();
int valueTypeIndex = encodedIndex.valueTypeIndex();
- const QQmlPropertyData *pd = targetDData->propertyCache->property(coreIndex);
+ QJSEngine *engine = qjsEngine(target);
+ if (!engine)
+ return; // dont crash
+ const QQmlPropertyData *pd =
+ QQmlData::ensurePropertyCache(engine, target)->property(coreIndex);
if (pd && valueTypeIndex != -1 && !QQmlMetaType::valueType(pd->propType())) {
// deep alias
QQmlEnginePrivate *enginePriv = QQmlEnginePrivate::get(metaObject->compilationUnit->engine->qmlEngine());
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index c9e513ded4..e8900a0d69 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -238,18 +238,13 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
for (QmlIR::Object *object: qAsConst(irDocument.objects)) {
if (object->functionsAndExpressions->count == 0 && object->bindingCount() == 0)
continue;
- QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile;
- for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next)
- functionsToCompile << *foe;
- const QVector<int> runtimeFunctionIndices = v4CodeGen.generateJSCodeForFunctionsAndBindings(functionsToCompile);
- if (v4CodeGen.hasError()) {
+
+ if (!v4CodeGen.generateRuntimeFunctions(object)) {
+ Q_ASSERT(v4CodeGen.hasError());
error->appendDiagnostic(inputFileName, v4CodeGen.error());
return false;
}
- QQmlJS::MemoryPool *pool = irDocument.jsParserEngine.pool();
- object->runtimeFunctionIndices.allocate(pool, runtimeFunctionIndices);
-
if (!aotCompiler)
continue;
@@ -270,6 +265,12 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
std::copy(object->functionsBegin(), object->functionsEnd(),
std::back_inserter(bindingsAndFunctions));
+ QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile;
+ for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first;
+ foe; foe = foe->next) {
+ functionsToCompile << *foe;
+ }
+
// AOT-compile bindings and functions in the same order as above so that the runtime
// class indices match
std::sort(bindingsAndFunctions.begin(), bindingsAndFunctions.end());
@@ -326,7 +327,8 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
<< diagnosticErrorMessage(inputFileName, *error);
} else if (auto *func = std::get_if<QQmlJSAotFunction>(&result)) {
qCInfo(lcAotCompiler) << "Generated code:" << func->code;
- aotFunctionsByIndex[runtimeFunctionIndices[bindingOrFunction.index()]] = *func;
+ aotFunctionsByIndex[object->runtimeFunctionIndices[bindingOrFunction.index()]] =
+ *func;
}
});
}
diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp
index 5710b21ca0..039098a80e 100644
--- a/src/qmlmodels/qqmllistmodel.cpp
+++ b/src/qmlmodels/qqmllistmodel.cpp
@@ -2518,6 +2518,16 @@ void QQmlListModel::updateTranslations()
if (m_dynamicRoles)
return;
Q_ASSERT(m_listModel);
+
+ QList<int> roles;
+ for (int i = 0, end = m_listModel->roleCount(); i != end; ++i) {
+ if (m_listModel->getExistingRole(i).type == ListLayout::Role::String)
+ roles.append(i);
+ }
+
+ if (!roles.isEmpty())
+ emitItemsChanged(0, rowCount(QModelIndex()), roles);
+
m_listModel->updateTranslations();
}
diff --git a/src/qmltyperegistrar/qmltyperegistrar.cpp b/src/qmltyperegistrar/qmltyperegistrar.cpp
index af266064c0..981f8bb86e 100644
--- a/src/qmltyperegistrar/qmltyperegistrar.cpp
+++ b/src/qmltyperegistrar/qmltyperegistrar.cpp
@@ -192,11 +192,20 @@ int main(int argc, char **argv)
fprintf(output, "\n\n");
+ // Keep this in sync with _qt_internal_get_escaped_uri in CMake
QString moduleAsSymbol = module;
- moduleAsSymbol.replace(QLatin1Char('.'), QLatin1Char('_'));
+ moduleAsSymbol.replace(QRegularExpression(QStringLiteral("[^A-Za-z0-9]")), QStringLiteral("_"));
- const QString functionName = QStringLiteral("qml_register_types_") + moduleAsSymbol;
+ QString underscoredModuleAsSymbol = module;
+ underscoredModuleAsSymbol.replace(QLatin1Char('.'), QLatin1Char('_'));
+
+ if (underscoredModuleAsSymbol != moduleAsSymbol
+ || underscoredModuleAsSymbol.isEmpty()
+ || underscoredModuleAsSymbol.front().isDigit()) {
+ qWarning() << module << "is an invalid QML module URI. You cannot import this.";
+ }
+ const QString functionName = QStringLiteral("qml_register_types_") + moduleAsSymbol;
fprintf(output,
"#if !defined(QT_STATIC)\n"
"#define Q_QMLTYPE_EXPORT Q_DECL_EXPORT\n"
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp
index e3b3bfd111..6e2b25a605 100644
--- a/src/quick/handlers/qquickhoverhandler.cpp
+++ b/src/quick/handlers/qquickhoverhandler.cpp
@@ -102,10 +102,8 @@ bool QQuickHoverHandler::event(QEvent *event)
void QQuickHoverHandler::componentComplete()
{
QQuickSinglePointHandler::componentComplete();
- if (auto par = parentItem()) {
- par->setAcceptHoverEvents(true);
+ if (auto par = parentItem())
QQuickItemPrivate::get(par)->setHasHoverInChild(true);
- }
}
bool QQuickHoverHandler::wantsPointerEvent(QPointerEvent *event)
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index 5f36c11a95..c2d7df30fc 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -239,8 +239,8 @@ void QQuickPinchHandler::onActiveChanged()
m_startRotation = t->rotation();
m_startPos = t->position();
} else {
- m_startScale = 1;
- m_startRotation = 0;
+ m_startScale = m_accumulatedScale;
+ m_startRotation = 0; // TODO m_accumulatedRotation (QTBUG-94168)
}
qCDebug(lcPinchHandler) << "activated with starting scale" << m_startScale << "rotation" << m_startRotation;
} else {
diff --git a/src/quick/handlers/qquickwheelhandler.cpp b/src/quick/handlers/qquickwheelhandler.cpp
index 7f7b4c2626..dd2e6134c0 100644
--- a/src/quick/handlers/qquickwheelhandler.cpp
+++ b/src/quick/handlers/qquickwheelhandler.cpp
@@ -91,7 +91,7 @@ QQuickWheelHandler::QQuickWheelHandler(QQuickItem *parent)
}
/*!
- \qmlproperty enum QtQuick::WheelHandler::orientation
+ \qmlproperty enumeration QtQuick::WheelHandler::orientation
Which wheel to react to. The default is \c Qt.Vertical.
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index e6ffcee2aa..ba81028822 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -482,7 +482,9 @@ void QQuickDragAttached::setKeys(const QStringList &keys)
\qmlattachedproperty stringlist QtQuick::Drag::mimeData
\since 5.2
- This property holds a map of mimeData that is used during startDrag.
+ This property holds a map from mime type to data that is used during startDrag.
+ The mime data needs to be a \c string, or an \c ArrayBuffer with the data encoded
+ according to the mime type.
*/
QVariantMap QQuickDragAttached::mimeData() const
@@ -767,8 +769,12 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct
QDrag *drag = new QDrag(source ? source : q);
QMimeData *mimeData = new QMimeData();
- for (auto it = externalMimeData.cbegin(), end = externalMimeData.cend(); it != end; ++it)
- mimeData->setData(it.key(), it.value().toString().toUtf8());
+ for (auto it = externalMimeData.cbegin(), end = externalMimeData.cend(); it != end; ++it) {
+ if (it.value().typeId() == QMetaType::QByteArray)
+ mimeData->setData(it.key(), it.value().toByteArray());
+ else
+ mimeData->setData(it.key(), it.value().toString().toUtf8());
+ }
drag->setMimeData(mimeData);
if (pixmapLoader.isReady()) {
diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h
index b02a0ea2e1..38ec278adb 100644
--- a/src/quick/items/qquickdrag_p.h
+++ b/src/quick/items/qquickdrag_p.h
@@ -109,9 +109,12 @@ public:
void grab(QQuickItem *item) { m_items.insert(new Item(item)); }
iterator release(iterator at) { Item *item = *at; at = at.erase(); delete item; return at; }
+ auto& ignoreList() { return m_ignoreDragItems; }
+
private:
ItemList m_items;
+ QVarLengthArray<QQuickItem *, 4> m_ignoreDragItems;
QObject *m_target;
};
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index c13a0cb1ef..3c3ca3ea2b 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -752,7 +752,8 @@ void QQuickFlickablePrivate::updateBeginningEnd()
/*!
\qmlsignal QtQuick::Flickable::flickEnded()
- This signal is emitted when the view stops moving due to a flick.
+ This signal is emitted when the view stops moving after a flick
+ or a series of flicks.
*/
/*!
@@ -1150,7 +1151,9 @@ void QQuickFlickablePrivate::maybeBeginDrag(qint64 currentTimestamp, const QPoin
pressPos = pressPosn;
hData.pressPos = hData.move.value();
vData.pressPos = vData.move.value();
- bool wasFlicking = hData.flicking || vData.flicking;
+ const bool wasFlicking = hData.flicking || vData.flicking;
+ hData.flickingWhenDragBegan = hData.flicking;
+ vData.flickingWhenDragBegan = vData.flicking;
if (hData.flicking) {
hData.flicking = false;
emit q->flickingHorizontallyChanged();
@@ -2955,7 +2958,7 @@ void QQuickFlickable::movementEnding(bool hMovementEnding, bool vMovementEnding)
Q_D(QQuickFlickable);
// emit flicking signals
- bool wasFlicking = d->hData.flicking || d->vData.flicking;
+ const bool wasFlicking = d->hData.flicking || d->vData.flicking;
if (hMovementEnding && d->hData.flicking) {
d->hData.flicking = false;
emit flickingHorizontallyChanged();
@@ -2967,6 +2970,10 @@ void QQuickFlickable::movementEnding(bool hMovementEnding, bool vMovementEnding)
if (wasFlicking && (!d->hData.flicking || !d->vData.flicking)) {
emit flickingChanged();
emit flickEnded();
+ } else if (d->hData.flickingWhenDragBegan || d->vData.flickingWhenDragBegan) {
+ d->hData.flickingWhenDragBegan = !hMovementEnding;
+ d->vData.flickingWhenDragBegan = !vMovementEnding;
+ emit flickEnded();
}
// emit moving signals
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index a96f2780d9..4658f7c7cb 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -107,7 +107,7 @@ public:
, smoothVelocity(fp), atEnd(false), atBeginning(true)
, transitionToSet(false)
, fixingUp(false), inOvershoot(false), inRebound(false), moving(false), flicking(false)
- , dragging(false), extentsChanged(false)
+ , flickingWhenDragBegan(false), dragging(false), extentsChanged(false)
, explicitValue(false), minExtentDirty(true), maxExtentDirty(true)
, contentPositionChangedExternallyDuringDrag(false)
, unused(0)
@@ -157,21 +157,22 @@ public:
int vTime;
QQuickFlickablePrivate::Velocity smoothVelocity;
QPODVector<qreal,10> velocityBuffer;
- bool atEnd : 1;
- bool atBeginning : 1;
- bool transitionToSet : 1;
- bool fixingUp : 1;
- bool inOvershoot : 1;
- bool inRebound : 1;
- bool moving : 1;
- bool flicking : 1;
- bool dragging : 1;
- bool extentsChanged : 1;
- bool explicitValue : 1;
- mutable bool minExtentDirty : 1;
- mutable bool maxExtentDirty : 1;
- bool contentPositionChangedExternallyDuringDrag : 1;
- uint unused : 18;
+ uint atEnd : 1;
+ uint atBeginning : 1;
+ uint transitionToSet : 1;
+ uint fixingUp : 1;
+ uint inOvershoot : 1;
+ uint inRebound : 1;
+ uint moving : 1;
+ uint flicking : 1;
+ uint flickingWhenDragBegan : 1;
+ uint dragging : 1;
+ uint extentsChanged : 1;
+ uint explicitValue : 1;
+ mutable uint minExtentDirty : 1;
+ mutable uint maxExtentDirty : 1;
+ uint contentPositionChangedExternallyDuringDrag : 1;
+ uint unused : 17;
};
bool flickX(qreal velocity);
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index 2cf26142c8..c24a6cbfdd 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -83,6 +83,8 @@ public:
\note It important to understand the performance implications such items
can incur. See QQuickPaintedItem::RenderTarget and
QQuickPaintedItem::renderTarget.
+
+ \sa {Scene Graph - Painted Item}, {Writing QML Extensions with C++}
*/
/*!
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 74f00c22b9..37458542d3 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -442,6 +442,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering)
if (d->touchPoints.count() < 2) {
// A pinch gesture is not occurring, so stealing the grab is permitted.
setKeepTouchGrab(false);
+ setKeepMouseGrab(false);
// During filtering, there's no need to hold a grab for one point,
// because filtering happens for every event anyway.
// But if we receive the event via direct delivery, and give up the grab,
@@ -465,6 +466,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering)
pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
pe.setPoint1(mapFromScene(d->lastPoint1));
pe.setPoint2(mapFromScene(d->lastPoint2));
+ setKeepTouchGrab(false);
setKeepMouseGrab(false);
emit pinchFinished(&pe);
d->pinchStartDist = 0;
@@ -502,6 +504,8 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering)
d->initPinch = true;
event->setExclusiveGrabber(touchPoint1, this);
event->setExclusiveGrabber(touchPoint2, this);
+ setKeepTouchGrab(true);
+ setKeepMouseGrab(true);
}
if (d->pinchActivated && !d->pinchRejected) {
const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index c4829d3514..c87ea5b1f4 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -222,7 +222,7 @@ void QQuickRenderControlPrivate::windowDestroyed()
QQuickWindowPrivate::get(window)->animationController.reset();
#if QT_CONFIG(quick_shadereffect)
- QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
+ QSGRhiShaderEffectNode::cleanupMaterialTypeCache(window);
#endif
window = nullptr;
}
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 65de4a1a46..6ef868884a 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -1165,6 +1165,8 @@ QSGNode *QQuickShaderEffectImpl::handleUpdatePaintNode(QSGNode *oldNode, QQuickI
sd.fragment.shader = &m_shaders[Fragment];
sd.fragment.dirtyConstants = &m_dirtyConstants[Fragment];
sd.fragment.dirtyTextures = &m_dirtyTextures[Fragment];
+ sd.materialTypeCacheKey = m_item->window();
+
node->syncMaterial(&sd);
if (m_dirty & QSGShaderEffectNode::DirtyShaderMesh) {
@@ -1243,6 +1245,7 @@ bool QQuickShaderEffectImpl::updateUniformValue(const QByteArray &name, const QV
sd.fragment.shader = &m_shaders[Fragment];
sd.fragment.dirtyConstants = &dirtyConstants[Fragment];
sd.fragment.dirtyTextures = {};
+ sd.materialTypeCacheKey = m_item->window();
node->syncMaterial(&sd);
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 7aae597244..2fed5b1cfc 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -2800,7 +2800,7 @@ void QQuickTableViewPrivate::unloadEdge(Qt::Edge edge)
void QQuickTableViewPrivate::loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMode incubationMode)
{
const int edgeIndex = nextVisibleEdgeIndexAroundLoadedTable(edge);
- qCDebug(lcTableViewDelegateLifecycle) << edge << edgeIndex;
+ qCDebug(lcTableViewDelegateLifecycle) << edge << edgeIndex << q_func();
const auto visibleCells = edge & (Qt::LeftEdge | Qt::RightEdge)
? loadedRows.keys() : loadedColumns.keys();
@@ -3301,11 +3301,25 @@ void QQuickTableViewPrivate::syncSyncView()
if (syncHorizontally) {
q->setColumnSpacing(syncView->columnSpacing());
updateContentWidth();
+
+ if (syncView->leftColumn() != q->leftColumn()) {
+ // The left column is no longer the same as the left
+ // column in syncView. This requires a rebuild.
+ scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftColumn;
+ scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ }
}
if (syncVertically) {
q->setRowSpacing(syncView->rowSpacing());
updateContentHeight();
+
+ if (syncView->topRow() != q->topRow()) {
+ // The top row is no longer the same as the top
+ // row in syncView. This requires a rebuild.
+ scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftRow;
+ scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ }
}
if (syncView && loadedItems.isEmpty() && !tableSize.isEmpty()) {
@@ -3531,10 +3545,26 @@ void QQuickTableViewPrivate::setLocalViewportY(qreal contentY)
void QQuickTableViewPrivate::syncViewportRect()
{
- // Sync viewportRect so that it contains the actual geometry of the viewport
+ // Sync viewportRect so that it contains the actual geometry of the viewport.
+ // Since the column (and row) size of a sync child is decided by the column size
+ // of its sync view, the viewport width of a sync view needs to be the maximum of
+ // the sync views width, and its sync childrens width. This to ensure that no sync
+ // child loads a column which is not yet loaded by the sync view, since then the
+ // implicit column size cannot be resolved.
Q_Q(QQuickTableView);
- viewportRect = QRectF(q->contentX(), q->contentY(), q->width(), q->height());
- qCDebug(lcTableViewDelegateLifecycle) << viewportRect;
+
+ qreal w = q->width();
+ qreal h = q->height();
+
+ for (auto syncChild : std::as_const(syncChildren)) {
+ auto syncChild_d = syncChild->d_func();
+ if (syncChild_d->syncHorizontally)
+ w = qMax(w, syncChild->width());
+ if (syncChild_d->syncHorizontally)
+ h = qMax(h, syncChild->height());
+ }
+
+ viewportRect = QRectF(q->contentX(), q->contentY(), w, h);
}
void QQuickTableViewPrivate::syncViewportPosRecursive()
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index dd7f54518b..2df40bd272 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -2419,21 +2419,23 @@ void QQuickText::geometryChange(const QRectF &newGeometry, const QRectF &oldGeom
goto geomChangeDone;
if (!(widthChanged || widthMaximum) && !d->isLineLaidOutConnected()) { // only height has changed
- if (newGeometry.height() > oldGeometry.height()) {
- if (!d->heightExceeded && !qFuzzyIsNull(oldGeometry.height())) {
- // Height is adequate and growing, and it wasn't 0 previously.
- goto geomChangeDone;
- }
- if (d->lineCount == d->maximumLineCount()) // Reached maximum line and height is growing.
- goto geomChangeDone;
- } else if (newGeometry.height() < oldGeometry.height()) {
- if (d->lineCount < 2 && !verticalScale && newGeometry.height() > 0) // A single line won't be truncated until the text is 0 height.
- goto geomChangeDone;
-
- if (!verticalScale // no scaling, no eliding, and either unwrapped, or no maximum line count.
- && d->elideMode != QQuickText::ElideRight
- && !(d->maximumLineCountValid && d->widthExceeded)) {
- goto geomChangeDone;
+ if (!verticalPositionChanged) {
+ if (newGeometry.height() > oldGeometry.height()) {
+ if (!d->heightExceeded && !qFuzzyIsNull(oldGeometry.height())) {
+ // Height is adequate and growing, and it wasn't 0 previously.
+ goto geomChangeDone;
+ }
+ if (d->lineCount == d->maximumLineCount()) // Reached maximum line and height is growing.
+ goto geomChangeDone;
+ } else if (newGeometry.height() < oldGeometry.height()) {
+ if (d->lineCount < 2 && !verticalScale && newGeometry.height() > 0) // A single line won't be truncated until the text is 0 height.
+ goto geomChangeDone;
+
+ if (!verticalScale // no scaling, no eliding, and either unwrapped, or no maximum line count.
+ && d->elideMode != QQuickText::ElideRight
+ && !(d->maximumLineCountValid && d->widthExceeded)) {
+ goto geomChangeDone;
+ }
}
}
} else if (!heightChanged && widthMaximum) {
@@ -2961,7 +2963,7 @@ void QQuickTextPrivate::processHoverEvent(QHoverEvent *event)
emit q->linkHovered(extra->hoveredLink);
}
}
- event->setAccepted(!link.isEmpty());
+ event->ignore();
}
void QQuickText::hoverEnterEvent(QHoverEvent *event)
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index ebc13aa50f..1412b68ceb 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -2967,6 +2967,7 @@ void QQuickTextEdit::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickTextEdit);
if (d->isLinkHoveredConnected())
d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+ event->ignore();
}
void QQuickTextEdit::hoverMoveEvent(QHoverEvent *event)
@@ -2974,6 +2975,7 @@ void QQuickTextEdit::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickTextEdit);
if (d->isLinkHoveredConnected())
d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+ event->ignore();
}
void QQuickTextEdit::hoverLeaveEvent(QHoverEvent *event)
@@ -2981,6 +2983,7 @@ void QQuickTextEdit::hoverLeaveEvent(QHoverEvent *event)
Q_D(QQuickTextEdit);
if (d->isLinkHoveredConnected())
d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+ event->ignore();
}
/*!
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index f2148b0255..c08f357df8 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -2027,6 +2027,8 @@ QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property, const
if (argument.isValid())
return QVariant(QStringView{d->m_text}.left(d->m_cursor).right(argument.toInt()).toString());
return QVariant(d->m_text.left(d->m_cursor));
+ case Qt::ImReadOnly:
+ return QVariant(d->m_readOnly);
default:
return QQuickItem::inputMethodQuery(property);
}
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index b2acd59a11..4922148b27 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1096,7 +1096,11 @@ QQuickWindow::QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent)
}
/*!
- \internal
+ Constructs a window for displaying a QML scene, whose rendering will
+ be controlled by the \a control object.
+ Please refer to QQuickRenderControl's documentation for more information.
+
+ \since 5.4
*/
QQuickWindow::QQuickWindow(QQuickRenderControl *control)
: QWindow(*(new QQuickWindowPrivate), nullptr)
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index bce5932b50..c6877369c0 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -953,8 +953,14 @@ Renderer::~Renderer()
qsg_wipeBatch(m_batchPool.at(i), separateIndexBuffer);
}
- for (Node *n : qAsConst(m_nodes))
+ for (Node *n : qAsConst(m_nodes)) {
+ if (n->type() == QSGNode::GeometryNodeType) {
+ Element *e = n->element();
+ if (!e->removed)
+ m_elementsToDelete.add(e);
+ }
m_nodeAllocator.release(n);
+ }
// Remaining elements...
for (int i=0; i<m_elementsToDelete.size(); ++i)
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h
index 060d896b3c..82b930edf2 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.h
+++ b/src/quick/scenegraph/coreapi/qsggeometry.h
@@ -201,6 +201,7 @@ public:
void setLineWidth(float w);
private:
+ Q_DISABLE_COPY_MOVE(QSGGeometry)
friend class QSGGeometryData;
int m_drawing_mode;
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index e22ffa10d2..46637b326e 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -78,8 +78,8 @@ static void qt_print_node_count()
insertChildNodeAfter(). The order of nodes is important as geometry nodes
are rendered according to their ordering in the scene graph.
- The scene graph nodes contains a mechanism to describe which
- parts of the scene has changed. This includes the combined matrices,
+ The scene graph nodes contain a mechanism that describes which
+ parts of the scene have changed. This includes the combined matrices,
accumulated opacity, changes to the node hierarchy, and so on. This
information can be used for optimizations inside the scene graph renderer.
For the renderer to properly render the nodes, it is important that users
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index aa9f78f2c5..c3d286ee9d 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -353,6 +353,7 @@ public:
};
ShaderSyncData vertex;
ShaderSyncData fragment;
+ void *materialTypeCacheKey;
};
// Each ShaderEffect item has one node (render thread) and one manager (gui thread).
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 195cae07be..443afb00ac 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -371,7 +371,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
d->cleanupNodesOnShutdown();
#if QT_CONFIG(quick_shadereffect)
- QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
+ QSGRhiShaderEffectNode::cleanupMaterialTypeCache(window);
#endif
if (m_windows.size() == 0) {
diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
index 4667a001ed..e5903077a5 100644
--- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp
+++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
@@ -47,6 +47,7 @@
#include <QQmlFile>
#include <QFile>
#include <QFileSelector>
+#include <QMutexLocker>
QT_BEGIN_NAMESPACE
@@ -207,7 +208,8 @@ QSGMaterialType *QSGRhiShaderMaterialTypeCache::get(const QShader &vs, const QSh
return t;
}
-static QSGRhiShaderMaterialTypeCache shaderMaterialTypeCache;
+static QHash<void *, QSGRhiShaderMaterialTypeCache> shaderMaterialTypeCache;
+static QMutex shaderMaterialTypeCacheMutex;
class QSGRhiShaderEffectMaterialShader : public QSGMaterialShader
{
@@ -657,7 +659,12 @@ void QSGRhiShaderEffectNode::syncMaterial(SyncData *syncData)
m_material.m_fragmentShader = defaultFragmentShader;
}
- m_material.m_materialType = shaderMaterialTypeCache.get(m_material.m_vertexShader, m_material.m_fragmentShader);
+ {
+ QMutexLocker lock(&shaderMaterialTypeCacheMutex);
+ m_material.m_materialType = shaderMaterialTypeCache[syncData->materialTypeCacheKey].get(m_material.m_vertexShader,
+ m_material.m_fragmentShader);
+ }
+
m_material.m_linker.reset(m_material.m_vertexShader, m_material.m_fragmentShader);
if (m_material.m_hasCustomVertexShader) {
@@ -775,9 +782,10 @@ void QSGRhiShaderEffectNode::preprocess()
}
}
-void QSGRhiShaderEffectNode::cleanupMaterialTypeCache()
+void QSGRhiShaderEffectNode::cleanupMaterialTypeCache(void *materialTypeCacheKey)
{
- shaderMaterialTypeCache.reset();
+ QMutexLocker lock(&shaderMaterialTypeCacheMutex);
+ shaderMaterialTypeCache[materialTypeCacheKey].reset();
}
bool QSGRhiGuiThreadShaderEffectManager::hasSeparateSamplerAndTextureObjects() const
diff --git a/src/quick/scenegraph/qsgrhishadereffectnode_p.h b/src/quick/scenegraph/qsgrhishadereffectnode_p.h
index f8ccb0f756..f60c5c8895 100644
--- a/src/quick/scenegraph/qsgrhishadereffectnode_p.h
+++ b/src/quick/scenegraph/qsgrhishadereffectnode_p.h
@@ -135,7 +135,7 @@ public:
void syncMaterial(SyncData *syncData) override;
void preprocess() override;
- static void cleanupMaterialTypeCache();
+ static void cleanupMaterialTypeCache(void *materialTypeCacheKey);
private Q_SLOTS:
void handleTextureChange();
diff --git a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
index da9db65bc8..e46a2d9556 100644
--- a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
+++ b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
@@ -233,7 +233,10 @@ void QSGRhiTextureGlyphCache::endFillTexture()
int QSGRhiTextureGlyphCache::glyphPadding() const
{
- return 1;
+ if (m_format == QFontEngine::Format_Mono)
+ return 8;
+ else
+ return 1;
}
int QSGRhiTextureGlyphCache::maxTextureWidth() const
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index e23ce85583..45639ba93b 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -522,7 +522,7 @@ void QSGRenderThread::invalidateGraphics(QQuickWindow *window, bool inDestructor
if (wipeSG) {
dd->cleanupNodesOnShutdown();
#if QT_CONFIG(quick_shadereffect)
- QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
+ QSGRhiShaderEffectNode::cleanupMaterialTypeCache(window);
#endif
} else {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent SG, avoiding cleanup");
@@ -550,6 +550,7 @@ void QSGRenderThread::invalidateGraphics(QQuickWindow *window, bool inDestructor
}
QSGRhiSupport::instance()->destroyRhi(rhi);
rhi = nullptr;
+ dd->rhi = nullptr;
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- QRhi destroyed");
} else {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent GL, avoiding cleanup");
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
index 52deeb4f74..2cf52347a2 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -560,7 +560,11 @@ void QQuickDeliveryAgentPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem
if (!changed.isEmpty())
notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason);
-
+ if (isSubsceneAgent) {
+ auto da = QQuickWindowPrivate::get(rootItem->window())->deliveryAgent;
+ qCDebug(lcFocus) << " delegating clearFocusInScope to" << da;
+ QQuickWindowPrivate::get(rootItem->window())->deliveryAgentPrivate()->clearFocusInScope(da->rootItem(), item, reason, options);
+ }
if (oldActiveFocusItem == activeFocusItem)
qCDebug(lcFocus) << "activeFocusItem remains" << activeFocusItem << "in" << q;
else
@@ -972,9 +976,6 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEvent(
const QPointF &scenePos, const QPointF &lastScenePos,
Qt::KeyboardModifiers modifiers, ulong timestamp)
{
- if (!QQuickItemPrivate::get(rootItem)->subtreeHoverEnabled)
- return false;
-
// The first time this function is called, hoverItems is empty.
// We then call deliverHoverEventRecursive from the rootItem, and
// populate the list with all the children and grandchildren that
@@ -990,11 +991,19 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEvent(
// visit will still have an old hoverId. We can therefore go through the
// list at the end of this function and look for items with an old hoverId,
// remove them from the list, and update their state accordingly.
- currentHoverId++;
- hoveredLeafItemFound = false;
+ const bool subtreeHoverEnabled = QQuickItemPrivate::get(rootItem)->subtreeHoverEnabled;
const bool itemsWasHovered = !hoverItems.isEmpty();
- deliverHoverEventRecursive(rootItem, scenePos, lastScenePos, modifiers, timestamp);
+
+ if (!subtreeHoverEnabled && !itemsWasHovered)
+ return false;
+
+ currentHoverId++;
+
+ if (subtreeHoverEnabled) {
+ hoveredLeafItemFound = false;
+ deliverHoverEventRecursive(rootItem, scenePos, lastScenePos, modifiers, timestamp);
+ }
// Prune the list for items that are no longer hovered
for (auto it = hoverItems.begin(); it != hoverItems.end();) {
@@ -1025,10 +1034,11 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEvent(
accepted, recursion stops. Returns \c true in that case, or \c false if the
event is rejected.
- All items that have hover enabled (either explicitly, from
- setAcceptHoverEvents(), or implicitly by having HoverHandlers) will have
- the QQuickItemPrivate::hoverEnabled flag set. And all their anchestors will
- have the QQuickItemPrivate::subtreeHoverEnabledset. This function will
+ Each item that has hover enabled (from setAcceptHoverEvents()) has the
+ QQuickItemPrivate::hoverEnabled flag set. This only controls whether we
+ should send hover events to the item itself. (HoverHandlers no longer set
+ this flag.) When an item has hoverEnabled set, all its ancestors have the
+ QQuickItemPrivate::subtreeHoverEnabled set. This function will
follow the subtrees that have subtreeHoverEnabled by recursing into each
child with that flag set. And for each child (in addition to the item
itself) that also has hoverEnabled set, we call deliverHoverEventToItem()
@@ -1040,10 +1050,19 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEvent(
of an item that is stacked underneath, will not. Note that since siblings
can overlap, there can be more than one leaf item under the mouse.
+ Note that HoverHandler doesn't set the hoverEnabled flag on the parent item.
+ But still, adding a HoverHandler to an item will set its subtreeHoverEnabled flag.
+ So all the propagation logic described above will otherwise be the same.
+ But the hoverEnabled flag can be used to resolve if subtreeHoverEnabled is on
+ because the application explicitly requested it (setAcceptHoverEvents()), or
+ indirectly, because the item has HoverHandlers.
+
For legacy reasons (Qt 6.1), as soon as we find a leaf item that has hover
enabled, and therefore receives the event, we stop recursing into the remaining
siblings (even if the event was ignored). This means that we only allow hover
events to propagate up the direct parent-child hierarchy, and not to siblings.
+ However, if the first candidate HoverHandler is disabled, delivery continues
+ to the next one, which may be a sibling (QTBUG-106548).
*/
bool QQuickDeliveryAgentPrivate::deliverHoverEventRecursive(
QQuickItem *item, const QPointF &scenePos, const QPointF &lastScenePos,
@@ -1081,8 +1100,7 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventRecursive(
// All decendants have been visited.
// Now deliver the event to the item
- if (itemPrivate->hoverEnabled)
- return deliverHoverEventToItem(item, scenePos, lastScenePos, modifiers, timestamp, false);
+ return deliverHoverEventToItem(item, scenePos, lastScenePos, modifiers, timestamp, false);
// Continue propagation / recursion
return false;
@@ -1109,14 +1127,17 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem(
qCDebug(lcHoverTrace) << "item:" << item << "scene pos:" << scenePos << "localPos:" << localPos
<< "wasHovering:" << wasHovering << "isHovering:" << isHovering;
- if (isHovering)
- hoveredLeafItemFound = true;
-
- // Send enter/move/leave event to the item
bool accepted = false;
- if (isHovering && !clearHover) {
+
+ // Start by sending out enter/move/leave events to the item.
+ // Note that hoverEnabled only controls if we should send out hover events to the
+ // item itself. HoverHandlers are not included, and are dealt with separately below.
+ if (itemPrivate->hoverEnabled && isHovering && !clearHover) {
// Add the item to the list of hovered items (if it doesn't exist there
// from before), and update hoverId to mark that it's (still) hovered.
+ // Also set hoveredLeafItemFound, so that only propagate in a straight
+ // line towards the root from now on.
+ hoveredLeafItemFound = true;
hoverItems[item] = currentHoverId;
if (wasHovering)
accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, timestamp);
@@ -1131,6 +1152,7 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem(
if (!itemPrivate->hasPointerHandlers())
return accepted;
+ // Next, send out hover events to the hover handlers.
// If the item didn't accept the hover event, 'accepted' is now false.
// Otherwise it's true, and then it should stay the way regardless of
// whether or not the hoverhandlers themselves are hovered.
@@ -1144,6 +1166,8 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem(
for (QQuickPointerHandler *h : itemPrivate->extra->pointerHandlers) {
if (QQuickHoverHandler *hh = qmlobject_cast<QQuickHoverHandler *>(h)) {
+ if (!hh->isHovered())
+ continue;
hoverEvent.setAccepted(true);
QCoreApplication::sendEvent(hh, &hoverEvent);
}
@@ -1154,11 +1178,14 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem(
for (QQuickPointerHandler *h : itemPrivate->extra->pointerHandlers) {
if (QQuickHoverHandler *hh = qmlobject_cast<QQuickHoverHandler *>(h)) {
+ if (!hh->enabled())
+ continue;
hoverEvent.setAccepted(true);
hh->handlePointerEvent(&hoverEvent);
if (hh->isHovered()) {
// Mark the whole item as updated, even if only the handler is
// actually in a hovered state (because of HoverHandler.margins)
+ hoveredLeafItemFound = true;
hoverItems[item] = currentHoverId;
}
}
@@ -2098,18 +2125,16 @@ void QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(QQuickItem *item, b
qCDebug(lcTouch) << "actually delivering" << &touchEvent << " to " << item;
QCoreApplication::sendEvent(item, &touchEvent);
eventAccepted = touchEvent.isAccepted();
- } else if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) {
+ } else {
// If the touch event wasn't accepted, synthesize a mouse event and see if the item wants it.
- if (!eventAccepted && (itemPrivate->acceptedMouseButtons() & Qt::LeftButton)) {
- // send mouse event
- if (deliverTouchAsMouse(item, &touchEvent))
- eventAccepted = true;
- }
+ if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) &&
+ !eventAccepted && (itemPrivate->acceptedMouseButtons() & Qt::LeftButton))
+ deliverTouchAsMouse(item, &touchEvent);
+ return;
}
+ Q_ASSERT(item->acceptTouchEvents()); // else we would've returned early above
if (eventAccepted) {
- // If the touch was accepted (regardless by whom or in what form),
- // update accepted new points.
bool isPressOrRelease = pointerEvent->isBeginEvent() || pointerEvent->isEndEvent();
for (int i = 0; i < touchEvent.pointCount(); ++i) {
auto &point = touchEvent.point(i);
@@ -2162,6 +2187,7 @@ void QQuickDeliveryAgentPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QE
QDragLeaveEvent leaveEvent;
for (; grabItem != grabber->end(); grabItem = grabber->release(grabItem))
QCoreApplication::sendEvent(**grabItem, &leaveEvent);
+ grabber->ignoreList().clear();
return;
} else {
QDragMoveEvent *moveEvent = static_cast<QDragMoveEvent *>(event);
@@ -2219,6 +2245,8 @@ void QQuickDeliveryAgentPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QE
e->modifiers());
QQuickDropEventEx::copyActions(&enterEvent, *e);
event->setAccepted(deliverDragEvent(grabber, rootItem, &enterEvent));
+ } else {
+ grabber->ignoreList().clear();
}
}
@@ -2232,8 +2260,13 @@ bool QQuickDeliveryAgentPrivate::deliverDragEvent(
QPointF p = item->mapFromScene(event->position().toPoint());
bool itemContained = item->contains(p);
- if (!itemContained && itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
- return false;
+ const int itemIndex = grabber->ignoreList().indexOf(item);
+ if (!itemContained) {
+ if (itemIndex >= 0)
+ grabber->ignoreList().remove(itemIndex);
+
+ if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape)
+ return false;
}
QDragEnterEvent enterEvent(
@@ -2263,15 +2296,19 @@ bool QQuickDeliveryAgentPrivate::deliverDragEvent(
}
if (event->type() == QEvent::DragMove || itemPrivate->flags & QQuickItem::ItemAcceptsDrops) {
- if (event->type() == QEvent::DragEnter && formerTarget) {
- QQuickItem *formerTargetItem = qobject_cast<QQuickItem *>(formerTarget);
- if (formerTargetItem && currentGrabItems) {
- QDragLeaveEvent leaveEvent;
- QCoreApplication::sendEvent(formerTarget, &leaveEvent);
-
- // Remove the item from the currentGrabItems so a leave event won't be generated
- // later on
- currentGrabItems->removeAll(formerTarget);
+ if (event->type() == QEvent::DragEnter) {
+ if (formerTarget) {
+ QQuickItem *formerTargetItem = qobject_cast<QQuickItem *>(formerTarget);
+ if (formerTargetItem && currentGrabItems) {
+ QDragLeaveEvent leaveEvent;
+ QCoreApplication::sendEvent(formerTarget, &leaveEvent);
+
+ // Remove the item from the currentGrabItems so a leave event won't be generated
+ // later on
+ currentGrabItems->removeAll(formerTarget);
+ }
+ } else if (itemIndex >= 0) {
+ return false;
}
}
@@ -2287,6 +2324,8 @@ bool QQuickDeliveryAgentPrivate::deliverDragEvent(
grabber->grab(item);
grabber->setTarget(item);
return true;
+ } else if (itemIndex < 0) {
+ grabber->ignoreList().append(item);
}
} else {
return true;
diff --git a/src/quickcontrols2/doc/src/includes/qquicktooltip.qdocinc b/src/quickcontrols2/doc/src/includes/qquicktooltip.qdocinc
new file mode 100644
index 0000000000..0046a2d8b0
--- /dev/null
+++ b/src/quickcontrols2/doc/src/includes/qquicktooltip.qdocinc
@@ -0,0 +1,6 @@
+//! [customize-note]
+\note to customize the \l {Attached Tool Tips}{attached ToolTip}, it
+must be provided as part of
+\l {Creating a Custom Style}{your own style}. To do a one-off
+customization of a \c ToolTip, see \l {Custom Tool Tips}.
+//! [customize-note]
diff --git a/src/quickcontrols2/doc/src/qtquickcontrols2-customize.qdoc b/src/quickcontrols2/doc/src/qtquickcontrols2-customize.qdoc
index 8e3c5456d8..8207b32ab7 100644
--- a/src/quickcontrols2/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/quickcontrols2/doc/src/qtquickcontrols2-customize.qdoc
@@ -109,6 +109,12 @@
An added benefit of these three methods is that it's not necessary to
implement the template from scratch.
+ \note the three approaches mentioned here do not work for customizing the
+ attached \l ToolTip, as that is a shared item created internally. To do
+ a one-off customization of a \c ToolTip, see \l {Custom Tool Tips}. To
+ customize the attached \c ToolTip, it must be provided as part of
+ \l {Creating a Custom Style}{your own style}.
+
\section1 Creating a Custom Style
There are several ways to go about creating your own styles. Below, we'll
@@ -542,7 +548,7 @@
\l {ApplicationWindow::background}{background}.
\code
- import
+ import QtQuick
import QtQuick.Controls
ApplicationWindow {
@@ -1027,6 +1033,7 @@
\printuntil }
\printuntil }
+ \include qquicktooltip.qdocinc customize-note
\section2 Customizing Tumbler
diff --git a/src/quickcontrols2/windows/SpinBox.qml b/src/quickcontrols2/windows/SpinBox.qml
index 72309c60cd..2f50f0d5e5 100644
--- a/src/quickcontrols2/windows/SpinBox.qml
+++ b/src/quickcontrols2/windows/SpinBox.qml
@@ -41,12 +41,9 @@ import QtQuick.NativeStyle as NativeStyle
T.SpinBox {
id: control
- property bool __nativeBackground: background instanceof NativeStyle.StyleItem
property bool nativeIndicators: up.indicator.hasOwnProperty("_qt_default")
&& down.indicator.hasOwnProperty("_qt_default")
- font.pixelSize: __nativeBackground ? background.styleFont(control).pixelSize : undefined
-
implicitWidth: Math.max(contentItem.implicitWidth + leftInset + rightInset,
90 /* minimum */ )
implicitHeight: Math.max(contentItem.implicitHeight, up.implicitIndicatorHeight + down.implicitIndicatorHeight)
@@ -54,10 +51,10 @@ T.SpinBox {
spacing: 2
- leftPadding: __nativeBackground ? background.contentPadding.left: 0
- topPadding: __nativeBackground ? background.contentPadding.top: 0
- rightPadding: (__nativeBackground ? background.contentPadding.right : 0) + rightInset
- bottomPadding: __nativeBackground ? background.contentPadding.bottom: 0
+ leftPadding: 0
+ topPadding: 0
+ rightPadding: rightInset
+ bottomPadding: 0
validator: IntValidator {
locale: control.locale.name
diff --git a/src/quicklayouts/qquickgridlayoutengine.cpp b/src/quicklayouts/qquickgridlayoutengine.cpp
index 5275d70c39..234c3a0d9b 100644
--- a/src/quicklayouts/qquickgridlayoutengine.cpp
+++ b/src/quicklayouts/qquickgridlayoutengine.cpp
@@ -51,11 +51,4 @@ void QQuickGridLayoutEngine::setAlignment(QQuickItem *quickItem, Qt::Alignment a
}
}
-Qt::Alignment QQuickGridLayoutEngine::alignment(QQuickItem *quickItem) const
-{
- if (QGridLayoutItem *item = findLayoutItem(quickItem))
- return item->alignment();
- return {};
-}
-
QT_END_NAMESPACE
diff --git a/src/quicklayouts/qquickgridlayoutengine_p.h b/src/quicklayouts/qquickgridlayoutengine_p.h
index ff42fa4d43..8b1a000e42 100644
--- a/src/quicklayouts/qquickgridlayoutengine_p.h
+++ b/src/quicklayouts/qquickgridlayoutengine_p.h
@@ -154,7 +154,6 @@ public:
}
void setAlignment(QQuickItem *quickItem, Qt::Alignment alignment);
- Qt::Alignment alignment(QQuickItem *quickItem) const;
};
diff --git a/src/quicklayouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp
index 701a83de42..80fea6923a 100644
--- a/src/quicklayouts/qquicklayout.cpp
+++ b/src/quicklayouts/qquicklayout.cpp
@@ -790,6 +790,18 @@ void QQuickLayout::componentComplete()
d->m_isReady = true;
}
+void QQuickLayout::maybeSubscribeToBaseLineOffsetChanges(QQuickItem *item)
+{
+ QQuickLayoutAttached *info = attachedLayoutObject(item, false);
+ if (info) {
+ if (info->alignment() == Qt::AlignBaseline && static_cast<QQuickLayout*>(item->parentItem()) == this) {
+ qmlobject_connect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem()));
+ } else {
+ qmlobject_disconnect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem()));
+ }
+ }
+}
+
void QQuickLayout::invalidate(QQuickItem * /*childItem*/)
{
Q_D(QQuickLayout);
@@ -864,7 +876,7 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value)
if (change == ItemChildAddedChange) {
Q_D(QQuickLayout);
QQuickItem *item = value.item;
- qmlobject_connect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem()));
+ maybeSubscribeToBaseLineOffsetChanges(item);
QQuickItemPrivate::get(item)->addItemChangeListener(this, changeTypes);
d->m_hasItemChangeListeners = true;
qCDebug(lcQuickLayouts) << "ChildAdded" << item;
@@ -872,7 +884,7 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value)
invalidate();
} else if (change == ItemChildRemovedChange) {
QQuickItem *item = value.item;
- qmlobject_disconnect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem()));
+ maybeSubscribeToBaseLineOffsetChanges(item);
QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
qCDebug(lcQuickLayouts) << "ChildRemoved" << item;
if (isReady())
diff --git a/src/quicklayouts/qquicklayout_p.h b/src/quicklayouts/qquicklayout_p.h
index f76d898b47..141fb3c8da 100644
--- a/src/quicklayouts/qquicklayout_p.h
+++ b/src/quicklayouts/qquicklayout_p.h
@@ -121,6 +121,8 @@ public:
void itemDestroyed(QQuickItem *item) override;
void itemVisibilityChanged(QQuickItem *item) override;
+ void maybeSubscribeToBaseLineOffsetChanges(QQuickItem *item);
+
Q_INVOKABLE void _q_dumpLayoutTree() const;
void dumpLayoutTreeRecursive(int level, QString &buf) const;
diff --git a/src/quicklayouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp
index acc87b2d6c..b4267704c6 100644
--- a/src/quicklayouts/qquicklinearlayout.cpp
+++ b/src/quicklayouts/qquicklinearlayout.cpp
@@ -318,6 +318,7 @@ void QQuickGridLayoutBase::setAlignment(QQuickItem *item, Qt::Alignment alignmen
{
Q_D(QQuickGridLayoutBase);
d->engine.setAlignment(item, alignment);
+ maybeSubscribeToBaseLineOffsetChanges(item);
}
QQuickGridLayoutBase::~QQuickGridLayoutBase()
diff --git a/src/quicklayouts/qquickstacklayout.cpp b/src/quicklayouts/qquickstacklayout.cpp
index 4fc8bdefc4..e49b18e5f2 100644
--- a/src/quicklayouts/qquickstacklayout.cpp
+++ b/src/quicklayouts/qquickstacklayout.cpp
@@ -205,6 +205,7 @@ void QQuickStackLayout::itemChange(QQuickItem::ItemChange change, const QQuickIt
stackLayoutAttached->setIndex(-1);
stackLayoutAttached->setIsCurrentItem(false);
}
+ m_cachedItemSizeHints.remove(item);
invalidate();
} else if (change == ItemChildAddedChange) {
invalidate();
@@ -293,11 +294,12 @@ void QQuickStackLayout::setAlignment(QQuickItem * /*item*/, Qt::Alignment /*alig
void QQuickStackLayout::invalidate(QQuickItem *childItem)
{
- const int indexOfChild = indexOf(childItem);
- if (indexOfChild >= 0 && indexOfChild < m_cachedItemSizeHints.count()) {
- m_cachedItemSizeHints[indexOfChild].min() = QSizeF();
- m_cachedItemSizeHints[indexOfChild].pref() = QSizeF();
- m_cachedItemSizeHints[indexOfChild].max() = QSizeF();
+ ensureLayoutItemsUpdated();
+ if (childItem) {
+ SizeHints &hints = m_cachedItemSizeHints[childItem];
+ hints.min() = QSizeF();
+ hints.pref() = QSizeF();
+ hints.max() = QSizeF();
}
for (int i = 0; i < Qt::NSizeHints; ++i)
@@ -322,7 +324,6 @@ void QQuickStackLayout::updateLayoutItems()
if (count != d->count) {
d->count = count;
emit countChanged();
- m_cachedItemSizeHints.resize(count);
}
for (int i = 0; i < count; ++i) {
QQuickItem *child = itemAt(i);
@@ -338,10 +339,13 @@ void QQuickStackLayout::updateLayoutItems()
}
}
-QQuickStackLayout::SizeHints &QQuickStackLayout::cachedItemSizeHints(int index) const {
- SizeHints &hints = m_cachedItemSizeHints[index];
+QQuickStackLayout::SizeHints &QQuickStackLayout::cachedItemSizeHints(int index) const
+{
+ QQuickItem *item = itemAt(index);
+ Q_ASSERT(item);
+ SizeHints &hints = m_cachedItemSizeHints[item]; // will create an entry if it doesn't exist
if (!hints.min().isValid())
- QQuickStackLayout::collectItemSizeHints(itemAt(index), hints.array);
+ QQuickStackLayout::collectItemSizeHints(item, hints.array);
return hints;
}
diff --git a/src/quicklayouts/qquickstacklayout_p.h b/src/quicklayouts/qquickstacklayout_p.h
index 98e36645b9..a6ba38c20d 100644
--- a/src/quicklayouts/qquickstacklayout_p.h
+++ b/src/quicklayouts/qquickstacklayout_p.h
@@ -111,7 +111,7 @@ private:
QSizeF array[Qt::NSizeHints];
};
- mutable QVector<SizeHints> m_cachedItemSizeHints;
+ mutable QHash<QQuickItem*, SizeHints> m_cachedItemSizeHints;
mutable QSizeF m_cachedSizeHints[Qt::NSizeHints];
SizeHints &cachedItemSizeHints(int index) const;
};
diff --git a/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm b/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
index 2892c5edc9..d376726bdb 100644
--- a/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
+++ b/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
@@ -465,7 +465,11 @@ static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
if (sl->minimum >= sl->maximum)
return false;
- slider.frame = sl->rect.toCGRect();
+ // NSSlider seems to cache values based on tracking and the last layout of the
+ // NSView, resulting in incorrect knob rects that break the interaction with
+ // multiple sliders. So completely reinitialize the slider.
+ [slider initWithFrame:sl->rect.toCGRect()];
+
slider.minValue = sl->minimum;
slider.maxValue = sl->maximum;
slider.intValue = sl->sliderPosition;
@@ -495,6 +499,14 @@ static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
// the cell for its metrics and to draw itself.
[slider layoutSubtreeIfNeeded];
+ if (sl->state & QStyle::State_Sunken) {
+ const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
+ CGPoint pressPoint;
+ pressPoint.x = CGRectGetMidX(knobRect);
+ pressPoint.y = CGRectGetMidY(knobRect);
+ [slider.cell startTrackingAt:pressPoint inView:slider];
+ }
+
return true;
}
diff --git a/src/quicknativestyle/qstyle/qquickcommonstyle.cpp b/src/quicknativestyle/qstyle/qquickcommonstyle.cpp
index c5797009f7..81bd57d4aa 100644
--- a/src/quicknativestyle/qstyle/qquickcommonstyle.cpp
+++ b/src/quicknativestyle/qstyle/qquickcommonstyle.cpp
@@ -4508,12 +4508,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt) const
QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz) const
{
Q_D(const QCommonStyle);
- QSize sz(csz);
+ QSize sz(!csz.isEmpty() ? csz : QSize(0,0));
+
switch (ct) {
case CT_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- int w = csz.width(),
- h = csz.height(),
+ int w = sz.width(),
+ h = sz.height(),
bm = proxy()->pixelMetric(PM_ButtonMargin, btn),
fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn) * 2;
w += bm + fw;
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp
index fce4c3d680..4baf9a7123 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -1476,6 +1476,7 @@ static void generateGradientColorTable(const QQuickShapeGradientCacheKey &gradie
{
int pos = 0;
const QGradientStops &s = gradient.stops;
+ Q_ASSERT(!s.isEmpty());
const bool colorInterpolation = true;
uint alpha = qRound(opacity * 256);
@@ -1513,8 +1514,6 @@ static void generateGradientColorTable(const QQuickShapeGradientCacheKey &gradie
current_color = next_color;
}
- Q_ASSERT(s.size() > 0);
-
uint last_color = ARGB2RGBA(qPremultiply(ARGB_COMBINE_ALPHA(s[sLast].second.rgba(), alpha)));
for ( ; pos < size; ++pos)
colorTable[pos] = last_color;
@@ -1549,7 +1548,10 @@ QSGTexture *QQuickShapeGradientCache::get(const QQuickShapeGradientCacheKey &gra
if (!tx) {
static const int W = 1024; // texture size is 1024x1
QImage gradTab(W, 1, QImage::Format_RGBA8888_Premultiplied);
- generateGradientColorTable(grad, reinterpret_cast<uint *>(gradTab.bits()), W, 1.0f);
+ if (!grad.stops.isEmpty())
+ generateGradientColorTable(grad, reinterpret_cast<uint *>(gradTab.bits()), W, 1.0f);
+ else
+ gradTab.fill(Qt::black);
tx = new QSGPlainTexture;
tx->setImage(gradTab);
switch (grad.spread) {
diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp
index cd2b9efba2..01869c79ad 100644
--- a/src/quickshapes/qquickshapegenericrenderer.cpp
+++ b/src/quickshapes/qquickshapegenericrenderer.cpp
@@ -841,7 +841,7 @@ bool QQuickShapeRadialGradientRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
- QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(newMaterial);
+ QQuickShapeRadialGradientMaterial *m = static_cast<QQuickShapeRadialGradientMaterial *>(newMaterial);
bool changed = false;
QByteArray *buf = state.uniformData();
Q_ASSERT(buf->size() >= 92);
@@ -901,7 +901,7 @@ void QQuickShapeRadialGradientRhiShader::updateSampledImage(RenderState &state,
if (binding != 1)
return;
- QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(newMaterial);
+ QQuickShapeRadialGradientMaterial *m = static_cast<QQuickShapeRadialGradientMaterial *>(newMaterial);
QQuickShapeGenericStrokeFillNode *node = m->node();
const QQuickShapeGradientCacheKey cacheKey(node->m_fillGradient.stops, node->m_fillGradient.spread);
QSGTexture *t = QQuickShapeGradientCache::cacheForRhi(state.rhi())->get(cacheKey);
@@ -975,7 +975,7 @@ bool QQuickShapeConicalGradientRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
- QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(newMaterial);
+ QQuickShapeConicalGradientMaterial *m = static_cast<QQuickShapeConicalGradientMaterial *>(newMaterial);
bool changed = false;
QByteArray *buf = state.uniformData();
Q_ASSERT(buf->size() >= 80);
@@ -1019,7 +1019,7 @@ void QQuickShapeConicalGradientRhiShader::updateSampledImage(RenderState &state,
if (binding != 1)
return;
- QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(newMaterial);
+ QQuickShapeConicalGradientMaterial *m = static_cast<QQuickShapeConicalGradientMaterial *>(newMaterial);
QQuickShapeGenericStrokeFillNode *node = m->node();
const QQuickShapeGradientCacheKey cacheKey(node->m_fillGradient.stops, node->m_fillGradient.spread);
QSGTexture *t = QQuickShapeGradientCache::cacheForRhi(state.rhi())->get(cacheKey);
diff --git a/src/quicktemplates2/qquickdialog_p.h b/src/quicktemplates2/qquickdialog_p.h
index f4f902121f..9b42fa1519 100644
--- a/src/quicktemplates2/qquickdialog_p.h
+++ b/src/quicktemplates2/qquickdialog_p.h
@@ -65,7 +65,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup
Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
// 2.3 (Qt 5.10)
Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION(2, 3))
- Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+ QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
// 2.5 (Qt 5.12)
Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION(2, 5))
Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION(2, 5))
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index 8c7106160e..1829f9a30e 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -581,6 +581,30 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event)
d->handleRelease(d->window->contentItem(), event, nullptr);
break;
+ case QEvent::Wheel: {
+ // If the top item in the drawing-order is blocked by a modal popup, then
+ // eat the event. There is no scenario where the top most item is blocked
+ // by a popup, but an item further down in the drawing order is not.
+ QWheelEvent *we = static_cast<QWheelEvent *>(event);
+ const QVector<QQuickItem *> targetItems = d->deliveryAgentPrivate()->pointerTargets(
+ d->window->contentItem(), we, we->point(0), false, false);
+ if (targetItems.isEmpty())
+ break;
+
+ QQuickItem * const topItem = targetItems.first();
+ const auto popups = d->stackingOrderPopups();
+ for (const auto &popup : popups) {
+ if (!popup->overlayEvent(topItem, we))
+ continue;
+ const QQuickItem *popupItem = popup->popupItem();
+ if (!popupItem)
+ continue;
+ if (!popupItem->isAncestorOf(topItem))
+ return true;
+ }
+ break;
+ }
+
default:
break;
}
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 8bcd2244fc..265d5ba84a 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -355,6 +355,12 @@ bool QQuickPopupPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
bool QQuickPopupPrivate::blockInput(QQuickItem *item, const QPointF &point) const
{
+ // don't propagate events within the popup beyond the overlay
+ if (popupItem->contains(popupItem->mapFromScene(point))
+ && item == QQuickOverlay::overlay(window)) {
+ return true;
+ }
+
// don't block presses and releases
// a) outside a non-modal popup,
// b) to popup children/content, or
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 9c5c1a902f..4cedde66dc 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -1172,6 +1172,7 @@ void QQuickRangeSlider::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickRangeSlider);
QQuickControl::hoverEnterEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickRangeSlider::hoverMoveEvent(QHoverEvent *event)
@@ -1179,6 +1180,7 @@ void QQuickRangeSlider::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickRangeSlider);
QQuickControl::hoverMoveEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickRangeSlider::hoverLeaveEvent(QHoverEvent *event)
@@ -1187,6 +1189,7 @@ void QQuickRangeSlider::hoverLeaveEvent(QHoverEvent *event)
QQuickControl::hoverLeaveEvent(event);
d->first->setHovered(false);
d->second->setHovered(false);
+ event->ignore();
}
void QQuickRangeSlider::keyReleaseEvent(QKeyEvent *event)
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 83c00185c8..fbcd772dc5 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -839,6 +839,7 @@ void QQuickScrollBar::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickScrollBar);
QQuickControl::hoverEnterEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickScrollBar::hoverMoveEvent(QHoverEvent *event)
@@ -846,6 +847,7 @@ void QQuickScrollBar::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickScrollBar);
QQuickControl::hoverMoveEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickScrollBar::hoverLeaveEvent(QHoverEvent *event)
@@ -854,6 +856,7 @@ void QQuickScrollBar::hoverLeaveEvent(QHoverEvent *event)
QQuickControl::hoverLeaveEvent(event);
d->updateHover(QPoint(), false); //position is not needed when we force it to unhover
+ event->ignore();
}
#endif
@@ -912,6 +915,7 @@ void QQuickScrollBarAttachedPrivate::setFlickable(QQuickFlickable *item)
// The latter doesn't remove the listener but only resets its types. Thus, it leaves behind a dangling
// pointer on destruction.
QQuickItemPrivate::get(flickable)->removeItemChangeListener(this, QQuickItemPrivate::Geometry);
+ QQuickItemPrivate::get(flickable)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed);
if (horizontal)
cleanupHorizontal();
if (vertical)
@@ -921,7 +925,10 @@ void QQuickScrollBarAttachedPrivate::setFlickable(QQuickFlickable *item)
flickable = item;
if (item) {
+ // Don't know how to combine these calls into one, and as long as they're separate calls,
+ // the remove* calls above need to be separate too, otherwise they will have no effect.
QQuickItemPrivate::get(item)->updateOrAddGeometryChangeListener(this, QQuickGeometryChange::Size);
+ QQuickItemPrivate::get(item)->updateOrAddItemChangeListener(this, QQuickItemPrivate::Destroyed);
if (horizontal)
initHorizontal();
if (vertical)
@@ -1135,6 +1142,8 @@ void QQuickScrollBarAttachedPrivate::itemImplicitHeightChanged(QQuickItem *item)
void QQuickScrollBarAttachedPrivate::itemDestroyed(QQuickItem *item)
{
+ if (item == flickable)
+ flickable = nullptr;
if (item == horizontal)
horizontal = nullptr;
if (item == vertical)
diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp
index b2b03e5dd9..9237017dfa 100644
--- a/src/quicktemplates2/qquickshortcutcontext.cpp
+++ b/src/quicktemplates2/qquickshortcutcontext.cpp
@@ -37,13 +37,18 @@
#include "qquickshortcutcontext_p_p.h"
#include "qquickoverlay_p_p.h"
#include "qquicktooltip_p.h"
+#include "qquickmenu_p.h"
+#include "qquickmenu_p_p.h"
#include "qquickpopup_p.h"
+#include <QtCore/qloggingcategory.h>
#include <QtGui/qguiapplication.h>
#include <QtQuick/qquickrendercontrol.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcContextMatcher, "qt.quick.controls.shortcutcontext.matcher")
+
static bool isBlockedByPopup(QQuickItem *item)
{
if (!item || !item->window())
@@ -77,12 +82,26 @@ bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context)
} else if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj)) {
obj = popup->window();
item = popup->popupItem();
+
+ if (!obj) {
+ // The popup has no associated window (yet). However, sub-menus,
+ // unlike top-level menus, will not have an associated window
+ // until their parent menu is opened. So, check if this is a sub-menu
+ // so that actions within it can grab shortcuts.
+ if (auto *menu = qobject_cast<QQuickMenu *>(popup)) {
+ auto parentMenu = QQuickMenuPrivate::get(menu)->parentMenu;
+ while (!obj && parentMenu)
+ obj = parentMenu->window();
+ }
+ }
break;
}
obj = obj->parent();
}
if (QWindow *renderWindow = QQuickRenderControl::renderWindowFor(qobject_cast<QQuickWindow *>(obj)))
obj = renderWindow;
+ qCDebug(lcContextMatcher) << "obj" << obj << "focusWindow" << QGuiApplication::focusWindow()
+ << "!isBlockedByPopup(item)" << !isBlockedByPopup(item);
return obj && obj == QGuiApplication::focusWindow() && !isBlockedByPopup(item);
default:
return false;
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 3412277cd7..f0d34c3659 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -888,6 +888,7 @@ void QQuickSpinBox::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickSpinBox);
QQuickControl::hoverEnterEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickSpinBox::hoverMoveEvent(QHoverEvent *event)
@@ -895,6 +896,7 @@ void QQuickSpinBox::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickSpinBox);
QQuickControl::hoverMoveEvent(event);
d->updateHover(event->position());
+ event->ignore();
}
void QQuickSpinBox::hoverLeaveEvent(QHoverEvent *event)
@@ -903,6 +905,7 @@ void QQuickSpinBox::hoverLeaveEvent(QHoverEvent *event)
QQuickControl::hoverLeaveEvent(event);
d->down->setHovered(false);
d->up->setHovered(false);
+ event->ignore();
}
void QQuickSpinBox::keyPressEvent(QKeyEvent *event)
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index d5d6eca780..d28718f2fb 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -1055,15 +1055,14 @@ void QQuickTextArea::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickTextArea);
QQuickTextEdit::hoverEnterEvent(event);
setHovered(d->hoverEnabled);
- event->setAccepted(d->hoverEnabled);
+ event->ignore();
}
void QQuickTextArea::hoverLeaveEvent(QHoverEvent *event)
{
- Q_D(QQuickTextArea);
QQuickTextEdit::hoverLeaveEvent(event);
setHovered(false);
- event->setAccepted(d->hoverEnabled);
+ event->ignore();
}
#endif
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index dffb4ec113..7cac120805 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -875,15 +875,14 @@ void QQuickTextField::hoverEnterEvent(QHoverEvent *event)
Q_D(QQuickTextField);
QQuickTextInput::hoverEnterEvent(event);
setHovered(d->hoverEnabled);
- event->setAccepted(d->hoverEnabled);
+ event->ignore();
}
void QQuickTextField::hoverLeaveEvent(QHoverEvent *event)
{
- Q_D(QQuickTextField);
QQuickTextInput::hoverLeaveEvent(event);
setHovered(false);
- event->setAccepted(d->hoverEnabled);
+ event->ignore();
}
#endif
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index d1944aa214..9d64360fd9 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -80,6 +80,8 @@ QT_BEGIN_NAMESPACE
shown for the last item that made it visible. The position of the shared tool
tip is determined by the framework.
+ \include qquicktooltip.qdocinc customize-note
+
\section2 Delay and Timeout
Tool tips are typically transient in a sense that they are shown as a
diff --git a/src/quicktestutils/CMakeLists.txt b/src/quicktestutils/CMakeLists.txt
index fe3c395429..ce629037e8 100644
--- a/src/quicktestutils/CMakeLists.txt
+++ b/src/quicktestutils/CMakeLists.txt
@@ -30,6 +30,7 @@ qt_internal_add_module(QuickTestUtilsPrivate
PUBLIC_LIBRARIES
Qt::Core
Qt::Test
+ Qt::Network
Qt::Qml
Qt::QmlPrivate
)
diff --git a/tests/auto/qml/debugger/qv4debugger/CMakeLists.txt b/tests/auto/qml/debugger/qv4debugger/CMakeLists.txt
index ecefcb65bc..e8fe26cb5a 100644
--- a/tests/auto/qml/debugger/qv4debugger/CMakeLists.txt
+++ b/tests/auto/qml/debugger/qv4debugger/CMakeLists.txt
@@ -10,6 +10,17 @@ file(GLOB_RECURSE test_data_glob
data/*)
list(APPEND test_data ${test_data_glob})
+qt_add_library(testCppTypes STATIC)
+qt_autogen_tools_initial_setup(testCppTypes)
+target_link_libraries(testCppTypes PRIVATE Qt::Qml Qt::QmlPrivate Qt::Quick)
+
+qt6_add_qml_module(testCppTypes
+ VERSION 1.0
+ URI TestTypes
+ SOURCES
+ commontypes.h
+)
+
qt_internal_add_test(tst_qv4debugger
SOURCES
../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp ../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
@@ -25,6 +36,7 @@ qt_internal_add_test(tst_qv4debugger
Qt::Network
Qt::QmlPrivate
Qt::QuickTestUtilsPrivate
+ testCppTypesplugin
TESTDATA ${test_data}
)
diff --git a/tests/auto/qml/debugger/qv4debugger/commontypes.h b/tests/auto/qml/debugger/qv4debugger/commontypes.h
new file mode 100644
index 0000000000..01b2125ae3
--- /dev/null
+++ b/tests/auto/qml/debugger/qv4debugger/commontypes.h
@@ -0,0 +1,20 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#ifndef COMMONTYPES_H
+#define COMMONTYPES_H
+
+#include <QtQuick/qquickitem.h>
+#include <QtQml/qqmlregistration.h>
+#include <QtQml/private/qv4engine_p.h>
+
+class MyType : public QQuickItem
+{
+ Q_OBJECT
+ QML_ELEMENT
+public:
+ MyType(QQuickItem *parent = nullptr) : QQuickItem(parent) {}
+ Q_INVOKABLE void name(QQmlV4Function*) const {}
+};
+
+#endif // COMMONTYPES_H
diff --git a/tests/auto/qml/debugger/qv4debugger/data/qtbug_107607.qml b/tests/auto/qml/debugger/qv4debugger/data/qtbug_107607.qml
new file mode 100644
index 0000000000..a7758de8a8
--- /dev/null
+++ b/tests/auto/qml/debugger/qv4debugger/data/qtbug_107607.qml
@@ -0,0 +1,10 @@
+import QtQuick
+import TestTypes
+MyType {
+ objectName: "patron"
+ Item {
+ Component.onCompleted: {
+ console.log("Hallo Welt");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
index beaee6c61a..b9b2fd6b69 100644
--- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -41,10 +41,13 @@
#include <private/qv4string_p.h>
#include <private/qqmlbuiltinfunctions_p.h>
#include <private/qqmldebugservice_p.h>
+#include <QtQml/qqmlextensionplugin.h>
using namespace QV4;
using namespace QV4::Debugging;
+Q_IMPORT_QML_PLUGIN(TestTypesPlugin);
+
typedef QV4::ReturnedValue (*InjectedFunction)(const FunctionObject *b, const QV4::Value *, const QV4::Value *, int);
Q_DECLARE_METATYPE(InjectedFunction)
@@ -201,7 +204,15 @@ public slots:
ExpressionEvalJob job(debugger->engine(), request.frameNr, request.context,
request.expression, &collector);
debugger->runInEngine(&job);
- m_expressionResults << job.returnValue();
+ const QJsonObject& result = job.returnValue();
+ m_expressionResults << result;
+
+ if (request.shouldLookup) {
+ QJsonArray handles {result.value("handle").toInt()};
+ ValueLookupJob job(handles, &collector);
+ debugger->runInEngine(&job);
+ m_lookupResults << job.returnValue();
+ }
}
if (m_captureContextInfo)
@@ -274,10 +285,14 @@ public:
QString expression;
int frameNr;
int context;
+ bool shouldLookup = false;
};
+
+
QVector<ExpressionRequest> m_expressionRequests;
QV4Debugger::Speed m_resumeSpeed;
QList<QJsonObject> m_expressionResults;
+ QList<QJsonObject> m_lookupResults;
QV4Debugger *m_debugger;
// Utility methods:
@@ -331,7 +346,7 @@ private slots:
void readThis();
void signalParameters();
-
+ void debuggerNoCrash();
private:
QV4Debugger *debugger() const
{
@@ -941,6 +956,42 @@ void tst_qv4debugger::signalParameters()
QCOMPARE(obj->property("resultCallbackExternal").toString(), QLatin1String("unset"));
}
+void tst_qv4debugger::debuggerNoCrash()
+{
+ QQmlEngine engine;
+ QV4::ExecutionEngine *v4 = engine.handle();
+ QPointer<QV4Debugger> v4Debugger = new QV4Debugger(v4);
+ v4->setDebugger(v4Debugger.data());
+
+ QScopedPointer<QThread> debugThread(new QThread);
+ debugThread->start();
+ QScopedPointer<TestAgent> debuggerAgent(new TestAgent(v4));
+ debuggerAgent->addDebugger(v4Debugger);
+ debuggerAgent->moveToThread(debugThread.data());
+
+ const QString qmlFileName("qtbug_107607.qml");
+ const QString qmlFilePath(testFile(qmlFileName));
+ QQmlComponent component(&engine, qmlFilePath);
+
+ TestAgent::ExpressionRequest request;
+ request.expression = "this.parent";
+ request.frameNr = 0;
+ request.context = -1;
+ request.shouldLookup = true;
+ debuggerAgent->m_expressionRequests << request;
+ v4Debugger->addBreakPoint(qmlFileName, 7);
+
+ QScopedPointer<QObject> obj(component.create());
+
+ QVERIFY(debuggerAgent->m_lookupResults.size() > 0);
+ const QJsonObject result = debuggerAgent->m_lookupResults[0];
+ const QJsonArray properties = result["0"].toObject().value("properties").toArray();
+ QCOMPARE(properties[0].toObject().value("value").toString(), QStringLiteral("patron"));
+
+ debugThread->quit();
+ debugThread->wait();
+}
+
tst_qv4debugger::tst_qv4debugger() : QQmlDataTest(QT_QMLTEST_DATADIR) { }
QTEST_MAIN(tst_qv4debugger)
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 85ec400cea..a5e8713700 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -271,6 +271,7 @@ private slots:
void sortNonStringArray();
void iterateInvalidProxy();
void applyOnHugeArray();
+ void reflectApplyOnHugeArray();
void tostringRecursionCheck();
void arrayIncludesWithLargeArray();
@@ -5327,6 +5328,22 @@ void tst_QJSEngine::applyOnHugeArray()
QCOMPARE(value.toString(), "RangeError: Array too large for apply().");
}
+
+void tst_QJSEngine::reflectApplyOnHugeArray()
+{
+ QQmlEngine engine;
+ const QJSValue value = engine.evaluate(R"(
+(function(){
+const v1 = [];
+const v3 = [];
+v3.length = 3900000000;
+Reflect.apply(v1.reverse,v1,v3);
+})()
+ )");
+ QVERIFY(value.isError());
+ QCOMPARE(value.toString(), QLatin1String("RangeError: Invalid array length."));
+}
+
void tst_QJSEngine::typedArraySet()
{
QJSEngine engine;
diff --git a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
index 9dd38ce506..9ab6c69b9c 100644
--- a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
+++ b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
@@ -57,3 +57,13 @@ set_target_properties(tst_qmltyperegistrar PROPERTIES
# yet, so we have to call it directly to test that code path for now.
_qt_internal_qml_type_registration(tst_qmltyperegistrar MANUAL_MOC_JSON_FILES ${json_list})
add_subdirectory(foreign)
+
+qt_add_library(tst-qmltyperegistrar-with-dashes)
+target_link_libraries(tst-qmltyperegistrar-with-dashes PRIVATE Qt::Core Qt::Qml)
+qt_enable_autogen_tool(tst-qmltyperegistrar-with-dashes "moc" ON)
+qt_add_qml_module(tst-qmltyperegistrar-with-dashes
+ URI Module-With-Dashes
+ VERSION 1.0
+ SOURCES
+ foo.cpp foo.h
+)
diff --git a/tests/auto/qml/qqmlchangeset/CMakeLists.txt b/tests/auto/qml/qqmlchangeset/CMakeLists.txt
index da06b85fad..510e304717 100644
--- a/tests/auto/qml/qqmlchangeset/CMakeLists.txt
+++ b/tests/auto/qml/qqmlchangeset/CMakeLists.txt
@@ -1,10 +1,10 @@
# Generated from qqmlchangeset.pro.
#####################################################################
-## tst_qqmlhangeset Test:
+## tst_qqmlchangeset Test:
#####################################################################
-qt_internal_add_test(tst_qqmlhangeset
+qt_internal_add_test(tst_qqmlchangeset
SOURCES
tst_qqmlchangeset.cpp
PUBLIC_LIBRARIES
diff --git a/tests/auto/qml/qqmllanguage/data/ComponentType.qml b/tests/auto/qml/qqmllanguage/data/ComponentType.qml
new file mode 100644
index 0000000000..e8addde1c4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/ComponentType.qml
@@ -0,0 +1,8 @@
+import QtQml
+
+Component {
+ id: componentRoot
+ QtObject {
+ objectName: "enclosed"
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml b/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml
new file mode 100644
index 0000000000..0424ac1534
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml
@@ -0,0 +1,21 @@
+import QtQuick
+
+Item {
+ component Abc: Item {
+ property string success
+ }
+
+ signal canYouFeelIt(arg1: Abc)
+ property Abc someAbc: Abc {
+ success: "Signal was called"
+ }
+ property string success: "Signal not called yet"
+
+ Component.onCompleted: {
+ canYouFeelIt(someAbc);
+ }
+
+ onCanYouFeelIt: (arg) => {
+ success = arg.success
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/alias.15.qml b/tests/auto/qml/qqmllanguage/data/alias.15.qml
index 5f3de9c83e..7e362d8823 100644
--- a/tests/auto/qml/qqmllanguage/data/alias.15.qml
+++ b/tests/auto/qml/qqmllanguage/data/alias.15.qml
@@ -9,4 +9,25 @@ Item {
Item {
id: symbol
}
+
+ Rectangle {
+ id: txtElevationValue
+
+ property Rectangle background: Rectangle { }
+
+ state: "ValidatorInvalid"
+
+ states: [
+ State {
+ name: "ValidatorInvalid"
+ PropertyChanges {
+ target: txtElevationValue
+ background.border.color: "red" // this line caused the segfault in qtbug107795
+ }
+ },
+ State {
+ name: "ValidatorAcceptable"
+ }
+ ]
+ }
}
diff --git a/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml b/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml
new file mode 100644
index 0000000000..1b8ba61725
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml
@@ -0,0 +1,10 @@
+import QtQml
+
+QtObject {
+ id: testItem
+ property rect rect
+ onComplete {
+ rect.x: 2
+ rect.width: 22
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml
new file mode 100644
index 0000000000..44fbd03354
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl.qml
@@ -0,0 +1,10 @@
+import QtQuick
+Item {
+ id: root
+ Component {
+ id: accessibleNormal
+ Item {}
+ }
+ property alias accessibleNormalUrl: accessibleNormal.url
+ property url urlClone: root.accessibleNormalUrl // crashes qml utility
+}
diff --git a/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml
new file mode 100644
index 0000000000..cfdec5e39b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/bindingAliasToComponentUrl2.qml
@@ -0,0 +1,11 @@
+import QtQuick
+Item {
+ id: root
+ Component {
+ id: accessibleNormal
+ ComponentType {
+ id: inaccessibleNormal
+ }
+ }
+ property alias accessibleNormalProgress: accessibleNormal.progress
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml b/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml
new file mode 100644
index 0000000000..e20710edd9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml
@@ -0,0 +1,30 @@
+import QtQuick
+
+// this file performs two tests: first, using a signal with a inline component from another file
+// and second, calling the signal from another file using an inline component from another file
+
+Item {
+ signal canYouFeelIt(arg1:SignalInlineComponentArg.Abc)
+
+ property SignalInlineComponentArg.Abc someAbc: SignalInlineComponentArg.Abc {
+ success: "Own signal was called with component from another file"
+ }
+
+ property SignalInlineComponentArg fromAnotherFile: SignalInlineComponentArg {}
+
+ // success of own signal call with parameter from another file
+ property string successFromOwnSignal: "Signal not called yet"
+ // makes it easier to test
+ property string successFromSignalFromFile: fromAnotherFile.success
+
+ Component.onCompleted: {
+ canYouFeelIt(someAbc);
+ fromAnotherFile.someAbc.success = "Signal was called from another file"
+ fromAnotherFile.canYouFeelIt(fromAnotherFile.someAbc)
+ }
+
+ onCanYouFeelIt: (arg) => {
+ successFromOwnSignal = arg.success
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index a4f42f185d..06b2738c9e 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -384,6 +384,9 @@ private slots:
void uncreatableAttached();
void bindableOnly();
+ void badGroupedProperty();
+ void bindingAliasToComponentUrl();
+ void signalInlineComponentArg();
private:
QQmlEngine engine;
@@ -6604,6 +6607,58 @@ void tst_qqmllanguage::bindableOnly()
QCOMPARE(o->objectName(), QStringLiteral("score"));
}
+void tst_qqmllanguage::badGroupedProperty()
+{
+ QQmlEngine engine;
+ const QUrl url = testFileUrl("badGroupedProperty.qml");
+ QQmlComponent c(&engine, url);
+ QVERIFY(c.isError());
+ QCOMPARE(c.errorString(),
+ QStringLiteral("%1:6 Cannot assign to non-existent property \"onComplete\"\n")
+ .arg(url.toString()));
+}
+
+void tst_qqmllanguage::bindingAliasToComponentUrl()
+{
+ QQmlEngine engine;
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+ QCOMPARE(object->property("accessibleNormalUrl"), object->property("urlClone"));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl2.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+ QCOMPARE(object->property("accessibleNormalProgress"), QVariant(1.0));
+ }
+}
+
+void tst_qqmllanguage::signalInlineComponentArg()
+{
+ QQmlEngine engine;
+ {
+ QQmlComponent component(&engine, testFileUrl("SignalInlineComponentArg.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> object(component.create());
+
+ QCOMPARE(object->property("success"), QStringLiteral("Signal was called"));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("signalInlineComponentArg1.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> object(component.create());
+
+ QCOMPARE(object->property("successFromOwnSignal"),
+ QStringLiteral("Own signal was called with component from another file"));
+ QCOMPARE(object->property("successFromSignalFromFile"),
+ QStringLiteral("Signal was called from another file"));
+ }
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmllocale/data/functions.qml b/tests/auto/qml/qqmllocale/data/functions.qml
index 9fee78a836..42e26a508c 100644
--- a/tests/auto/qml/qqmllocale/data/functions.qml
+++ b/tests/auto/qml/qqmllocale/data/functions.qml
@@ -3,9 +3,6 @@ import QtQuick
QtObject {
property var locale: Qt.locale()
- // TODO: Workaround for not being able to use "Locale" in QQmlExpression (QTBUG-91747).
- property var localeType: Locale
-
function setLocale(l) {
locale = Qt.locale(l)
}
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index 7ef0275394..564c66c723 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -659,15 +659,15 @@ void tst_qqmllocale::addFormattedDataSizeDataForLocale(const QString &localeStr)
expectedResult = locale.formattedDataSize(1000000, 3);
QTest::newRow(qPrintable(makeTag())) << localeStr << functionCallScript << expectedResult << expectedErrorMessage;
- functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, localeType.DataSizeIecFormat)");
+ functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, Locale.DataSizeIecFormat)");
expectedResult = locale.formattedDataSize(1000000, 3, QLocale::DataSizeIecFormat);
QTest::newRow(qPrintable(makeTag())) << localeStr << functionCallScript << expectedResult << expectedErrorMessage;
- functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, localeType.DataSizeTraditionalFormat)");
+ functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, Locale.DataSizeTraditionalFormat)");
expectedResult = locale.formattedDataSize(1000000, 3, QLocale::DataSizeTraditionalFormat);
QTest::newRow(qPrintable(makeTag())) << localeStr << functionCallScript << expectedResult << expectedErrorMessage;
- functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, localeType.DataSizeSIFormat)");
+ functionCallScript = QLatin1String("locale.formattedDataSize(1000000, 3, Locale.DataSizeSIFormat)");
expectedResult = locale.formattedDataSize(1000000, 3, QLocale::DataSizeSIFormat);
QTest::newRow(qPrintable(makeTag())) << localeStr << functionCallScript << expectedResult << expectedErrorMessage;
}
@@ -691,7 +691,7 @@ void tst_qqmllocale::formattedDataSize_data()
QString errorMessage = ".*Locale: formattedDataSize\\(\\): Expected 1-3 arguments, but received 0";
QTest::newRow("too few args") << "en_AU" << functionCallScript << QString() << errorMessage;
- functionCallScript = "locale.formattedDataSize(10, 1, localeType.DataSizeIecFormat, \"foo\")";
+ functionCallScript = "locale.formattedDataSize(10, 1, Locale.DataSizeIecFormat, \"foo\")";
errorMessage = ".*Locale: formattedDataSize\\(\\): Expected 1-3 arguments, but received 4";
QTest::newRow("too many args") << "en_AU" << functionCallScript << QString() << errorMessage;
@@ -723,7 +723,9 @@ void tst_qqmllocale::formattedDataSize()
QVERIFY(QMetaObject::invokeMethod(object.data(), "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(localeStr))));
- QQmlExpression qmlExpression(engine.rootContext(), object.data(), functionCallScript);
+ // Make sure that we use the object's context rather than the root context,
+ // so that e.g. enums from the Locale type are available (QTBUG-91747).
+ QQmlExpression qmlExpression(qmlContext(object.data()), object.data(), functionCallScript);
const QVariant evaluationResult = qmlExpression.evaluate();
if (expectedErrorMessagePattern.isEmpty()) {
QVERIFY2(!qmlExpression.hasError(), qPrintable(qmlExpression.error().toString()));
diff --git a/tests/auto/qml/qqmltranslation/CMakeLists.txt b/tests/auto/qml/qqmltranslation/CMakeLists.txt
index 396eed518e..67047ff604 100644
--- a/tests/auto/qml/qqmltranslation/CMakeLists.txt
+++ b/tests/auto/qml/qqmltranslation/CMakeLists.txt
@@ -18,6 +18,7 @@ qt_internal_add_test(tst_qqmltranslation
Qt::Gui
Qt::GuiPrivate
Qt::QmlPrivate
+ Qt::QmlModelsPrivate
Qt::Quick
Qt::QuickTestUtilsPrivate
TESTDATA ${test_data}
diff --git a/tests/auto/qml/qqmltranslation/data/translatedElements.qml b/tests/auto/qml/qqmltranslation/data/translatedElements.qml
new file mode 100644
index 0000000000..c2edfe8c78
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/translatedElements.qml
@@ -0,0 +1,15 @@
+import QtQml
+import QtQml.Models
+
+DelegateModel {
+ model: ListModel {
+ ListElement { dish: qsTr("soup"); price: 60 }
+ ListElement { dish: qsTr("fish"); price: 100 }
+ ListElement { dish: qsTr("meat"); price: 230 }
+ ListElement { dish: qsTr("bread"); price: 10 }
+ }
+
+ delegate: QtObject {
+ required property string dish
+ }
+}
diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
index 5d2b6b8c31..5e0046fb03 100644
--- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
+++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
@@ -34,6 +34,7 @@
#include <QQuickItem>
#include <private/qqmlengine_p.h>
#include <private/qqmltypedata_p.h>
+#include <private/qqmldelegatemodel_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
class tst_qqmltranslation : public QQmlDataTest
@@ -48,6 +49,7 @@ private slots:
void idTranslation();
void translationChange();
void preferJSContext();
+ void listModel();
};
void tst_qqmltranslation::translation_data()
@@ -193,6 +195,14 @@ class DummyTranslator : public QTranslator
return QString::fromUtf8("Deutsch in mylibrary");
if (!qstrcmp(sourceText, "English in translation") && !qstrcmp(context, "nested_js_translation"))
return QString::fromUtf8("Deutsch in Setzung");
+ if (!qstrcmp(sourceText, "soup"))
+ return QString::fromUtf8("Suppe");
+ if (!qstrcmp(sourceText, "fish"))
+ return QString::fromUtf8("Fisch");
+ if (!qstrcmp(sourceText, "meat"))
+ return QString::fromUtf8("Fleisch");
+ if (!qstrcmp(sourceText, "bread"))
+ return QString::fromUtf8("Brot");
return QString();
}
@@ -254,6 +264,35 @@ void tst_qqmltranslation::preferJSContext()
QCoreApplication::removeTranslator(&translator);
}
+void tst_qqmltranslation::listModel()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("translatedElements.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o);
+
+ QQmlDelegateModel *model = qobject_cast<QQmlDelegateModel *>(o.data());
+ QVERIFY(model);
+
+ QCOMPARE(model->count(), 4);
+
+ QCOMPARE(model->object(0)->property("dish").toString(), QStringLiteral("soup"));
+ QCOMPARE(model->object(1)->property("dish").toString(), QStringLiteral("fish"));
+ QCOMPARE(model->object(2)->property("dish").toString(), QStringLiteral("meat"));
+ QCOMPARE(model->object(3)->property("dish").toString(), QStringLiteral("bread"));
+
+ DummyTranslator translator;
+ QCoreApplication::installTranslator(&translator);
+ engine.setUiLanguage(QStringLiteral("xxx"));
+ engine.retranslate();
+
+ QCOMPARE(model->object(0)->property("dish").toString(), QStringLiteral("Suppe"));
+ QCOMPARE(model->object(1)->property("dish").toString(), QStringLiteral("Fisch"));
+ QCOMPARE(model->object(2)->property("dish").toString(), QStringLiteral("Fleisch"));
+ QCOMPARE(model->object(3)->property("dish").toString(), QStringLiteral("Brot"));
+}
+
QTEST_MAIN(tst_qqmltranslation)
#include "tst_qqmltranslation.moc"
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
index 219c322f75..5d729c0428 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
@@ -61,6 +61,7 @@ private slots:
void hoverHandlerAndUnderlyingHoverHandler();
void mouseAreaAndUnderlyingHoverHandler();
void hoverHandlerAndUnderlyingMouseArea();
+ void disabledHoverHandlerAndUnderlyingMouseArea();
void movingItemWithHoverHandler();
void margin();
void window();
@@ -285,6 +286,52 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea()
#endif
}
+void tst_HoverHandler::disabledHoverHandlerAndUnderlyingMouseArea()
+{
+ // Check that if a disabled HoverHandler is installed on an item, it
+ // will not participate in hover event delivery, and as such, also
+ // not block propagation to siblings.
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "lesHoverables.qml");
+ QQuickView * window = windowPtr.data();
+ QQuickItem * bottomSidebar = window->rootObject()->findChild<QQuickItem *>("bottomSidebar");
+ QVERIFY(bottomSidebar);
+ QQuickMouseArea *bottomSidebarMA = bottomSidebar->findChild<QQuickMouseArea *>("bottomSidebarMA");
+ QVERIFY(bottomSidebarMA);
+ QQuickItem * button = bottomSidebar->findChild<QQuickItem *>("buttonWithHH");
+ QVERIFY(button);
+ QQuickHoverHandler *buttonHH = button->findChild<QQuickHoverHandler *>("buttonHH");
+ QVERIFY(buttonHH);
+
+ // By disabling the HoverHandler, it should no longer
+ // block the sibling MouseArea underneath from receiving hover events.
+ buttonHH->setEnabled(false);
+
+ QPoint buttonCenter(button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint());
+ QPoint rightOfButton(button->mapToScene(QPointF(button->width() + 2, button->height() / 2)).toPoint());
+ QPoint outOfSidebar(bottomSidebar->mapToScene(QPointF(bottomSidebar->width() + 2, bottomSidebar->height() / 2)).toPoint());
+ QSignalSpy sidebarHoveredSpy(bottomSidebarMA, SIGNAL(hoveredChanged()));
+ QSignalSpy buttonHoveredSpy(buttonHH, SIGNAL(hoveredChanged()));
+
+ QTest::mouseMove(window, outOfSidebar);
+ QCOMPARE(bottomSidebarMA->hovered(), false);
+ QCOMPARE(sidebarHoveredSpy.count(), 0);
+ QCOMPARE(buttonHH->isHovered(), false);
+ QCOMPARE(buttonHoveredSpy.count(), 0);
+
+ QTest::mouseMove(window, buttonCenter);
+ QCOMPARE(bottomSidebarMA->hovered(), true);
+ QCOMPARE(sidebarHoveredSpy.count(), 1);
+ QCOMPARE(buttonHH->isHovered(), false);
+ QCOMPARE(buttonHoveredSpy.count(), 0);
+
+ QTest::mouseMove(window, rightOfButton);
+ QCOMPARE(bottomSidebarMA->hovered(), true);
+ QCOMPARE(sidebarHoveredSpy.count(), 1);
+ QCOMPARE(buttonHH->isHovered(), false);
+ QCOMPARE(buttonHoveredSpy.count(), 0);
+}
+
void tst_HoverHandler::movingItemWithHoverHandler()
{
if (isPlatformWayland())
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/nullTarget.qml b/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/nullTarget.qml
new file mode 100644
index 0000000000..a348938aca
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/nullTarget.qml
@@ -0,0 +1,33 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick 2.15
+
+Item {
+ width: 320; height: 320
+ property alias pinchScale: pinch.scale
+
+ Rectangle {
+ objectName: "blackrect"
+ width: 200; height: 200
+ color: "black"
+ antialiasing: true
+ scale: pinch.scale
+ rotation: pinch.rotation
+ x: pinch.translation.x
+ y: pinch.translation.y
+
+ PinchHandler {
+ id: pinch
+ target: null
+ minimumScale: 0.5
+ maximumScale: 4
+ }
+
+ Text {
+ color: "cyan"
+ anchors.centerIn: parent
+ text: "scale " + pinch.scale.toFixed(2) + " activeScale " + pinch.activeScale.toFixed(2)
+ }
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/pinchproperties.qml b/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/pinchproperties.qml
index 425494ced6..1e6256cf03 100644
--- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/pinchproperties.qml
+++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/data/pinchproperties.qml
@@ -30,11 +30,38 @@ import QtQuick 2.12
Rectangle {
id: whiteRect
- property real scale: -1.0
+ property real pinchScale: -1.0
property int activeCount : 0
property int deactiveCount : 0
width: 320; height: 320
color: "white"
+
+ PointHandler {
+ id: ph1
+ acceptedDevices: PointerDevice.TouchScreen
+ target: Rectangle {
+ parent: whiteRect
+ color: "cyan"
+ x: ph1.point.position.x - 3
+ y: ph1.point.position.y - 3
+ width: 6; height: 6; radius: 3
+ }
+ }
+
+ PointHandler {
+ id: ph2
+ acceptedDevices: PointerDevice.TouchScreen
+ target: Rectangle {
+ parent: whiteRect
+ color: "lightgreen"
+ x: ph2.point.position.x - 3
+ y: ph2.point.position.y - 3
+ width: 6; height: 6; radius: 3
+ }
+ }
+
+ Text { color: "magenta"; z: 1; text: "scale: " + blackRect.scale}
+
Rectangle {
id: blackRect
objectName: "blackrect"
@@ -43,8 +70,7 @@ Rectangle {
x: 50
width: 100
height: 100
- opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
- Text { color: "white"; text: "opacity: " + blackRect.opacity + "\nscale: " + blackRect.scale}
+
Rectangle {
color: "red"
width: 6; height: 6; radius: 3
@@ -63,13 +89,13 @@ Rectangle {
xAxis.maximum: 140
yAxis.maximum: 170
onActiveChanged: {
- whiteRect.scale = pincharea.scale
+ whiteRect.pinchScale = pincharea.scale
if (active) ++activeCount
else ++deactiveCount;
}
onUpdated: {
- whiteRect.scale = pincharea.scale
+ whiteRect.pinchScale = pincharea.scale
//whiteRect.pointCount = pincharea.pointCount
}
}
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
index ba47adee72..7da37826b4 100644
--- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
@@ -54,6 +54,7 @@ public:
private slots:
void cleanupTestCase();
void pinchProperties();
+ void scale_data();
void scale();
void scaleThreeFingers();
void scaleNativeGesture_data();
@@ -204,91 +205,120 @@ QMutableEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i
return touchPoint;
}
-void tst_QQuickPinchHandler::scale()
+void tst_QQuickPinchHandler::scale_data()
{
- QQuickView *window = QQuickViewTestUtils::createView();
- QScopedPointer<QQuickView> scope(window);
- window->setSource(testFileUrl("pinchproperties.qml"));
- window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- QVERIFY(window->rootObject() != nullptr);
- qApp->processEvents();
+ QTest::addColumn<QUrl>("qmlfile");
+ QTest::addColumn<bool>("hasTarget");
+ QTest::newRow("targetModifying") << testFileUrl("pinchproperties.qml") << true;
+ QTest::newRow("nullTarget") << testFileUrl("nullTarget.qml") << false;
+}
- auto *pinchHandler = static_cast<PinchHandler *>(window->rootObject()->findChild<QQuickPinchHandler*>("pinchHandler"));
- QVERIFY(pinchHandler != nullptr);
- QSignalSpy grabChangedSpy(pinchHandler, SIGNAL(grabChanged(QPointingDevice::GrabTransition, QEventPoint)));
+void tst_QQuickPinchHandler::scale()
+{
+ QFETCH(QUrl, qmlfile);
+ QFETCH(bool, hasTarget);
- QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QQuickView window;
+ QVERIFY(QQuickTest::showView(window, qmlfile));
+ QQuickItem *root = qobject_cast<QQuickItem*>(window.rootObject());
QVERIFY(root != nullptr);
-
- // target
- QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ auto *pinchHandler = static_cast<PinchHandler *>(root->findChild<QQuickPinchHandler*>());
+ QVERIFY(pinchHandler != nullptr);
+ QQuickItem *blackRect = (hasTarget ? pinchHandler->target() : pinchHandler->parentItem());
QVERIFY(blackRect != nullptr);
+ QSignalSpy grabChangedSpy(pinchHandler, SIGNAL(grabChanged(QPointingDevice::GrabTransition, QEventPoint)));
QPoint p0(80, 80);
QPoint p1(100, 100);
- {
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, touchscreen);
- pinchSequence.press(0, p0, window).commit();
- QQuickTouchUtils::flush(window);
- // In order for the stationary point to remember its previous position,
- // we have to reuse the same pinchSequence object. Otherwise if we let it
- // be destroyed and then start a new sequence, point 0 will default to being
- // stationary at 0, 0, and pinchHandler will filter out that touchpoint because
- // it is outside its bounds.
- pinchSequence.stationary(0).press(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
- QTRY_COMPARE(grabChangedSpy.count(), 1); // passive grab
-
- QPoint pd(10, 10);
- // move one point until PinchHandler activates
- for (int pi = 0; pi < 10 && !pinchHandler->active(); ++pi) {
- p1 += pd;
- pinchSequence.stationary(0).move(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
- }
- QCOMPARE(pinchHandler->active(), true);
- // grabs occur when the handler becomes active; at that time, QQuickHandlerPoint.sceneGrabPosition should be correct
- QVERIFY(pinchHandler->firstPoint().sceneGrabPosition() != QPointF());
- QVERIFY(pinchHandler->lastPoint().sceneGrabPosition() != QPointF());
- QCOMPARE(pinchHandler->firstPoint().sceneGrabPosition(), pinchHandler->firstPoint().scenePosition());
- QCOMPARE(pinchHandler->lastPoint().sceneGrabPosition(), pinchHandler->lastPoint().scenePosition());
- // first point got a passive grab; both points got exclusive grabs
- QCOMPARE(grabChangedSpy.count(), 3);
- QLineF line(p0, p1);
- const qreal startLength = line.length();
-
- p1+=pd;
- pinchSequence.stationary(0).move(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
- line.setP2(p1);
- qreal scale = line.length() / startLength;
- QVERIFY(qFloatDistance(root->property("scale").toReal(), scale) < 10);
- QVERIFY(qFloatDistance(blackRect->scale(), scale) < 10);
-
- p1+=pd;
- pinchSequence.stationary(0).move(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(&window, touchscreen);
+ pinchSequence.press(0, p0, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object. Otherwise if we let it
+ // be destroyed and then start a new sequence, point 0 will default to being
+ // stationary at 0, 0, and pinchHandler will filter out that touchpoint because
+ // it is outside its bounds.
+ pinchSequence.stationary(0).press(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ QCOMPARE(grabChangedSpy.size(), 1); // passive grab
+
+ QPoint pd(10, 10);
+ // move one point until PinchHandler activates
+ for (int pi = 0; pi < 10 && !pinchHandler->active(); ++pi) {
+ p1 += pd;
+ pinchSequence.stationary(0).move(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ }
+ QCOMPARE(pinchHandler->active(), true);
+ // grabs occur when the handler becomes active; at that time, QQuickHandlerPoint.sceneGrabPosition should be correct
+ QVERIFY(pinchHandler->firstPoint().sceneGrabPosition() != QPointF());
+ QVERIFY(pinchHandler->lastPoint().sceneGrabPosition() != QPointF());
+ QCOMPARE(pinchHandler->firstPoint().sceneGrabPosition(), pinchHandler->firstPoint().scenePosition());
+ QCOMPARE(pinchHandler->lastPoint().sceneGrabPosition(), pinchHandler->lastPoint().scenePosition());
+ // first point got a passive grab; both points got exclusive grabs
+ QCOMPARE(grabChangedSpy.size(), 3);
+ QLineF line(p0, p1);
+ const qreal startLength = line.length();
+
+ // move the same point even further and observe the change in scale
+ for (int i = 0; i < 2; ++i) {
+ p1 += pd;
+ pinchSequence.stationary(0).move(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ if (lcPointerTests().isDebugEnabled()) QTest::qWait(500);
line.setP2(p1);
- scale = line.length() / startLength;
-
- QVERIFY(qFloatDistance(root->property("scale").toReal(), scale) < 10);
- QVERIFY(qFloatDistance(blackRect->scale(), scale) < 10);
-
- QPointF expectedCentroid = p0 + (p1 - p0)/2;
+ qreal expectedScale = line.length() / startLength;
+ QVERIFY(qFloatDistance(root->property("pinchScale").toReal(), expectedScale) < 10);
+ QVERIFY(qFloatDistance(blackRect->scale(), expectedScale) < 10);
+ QCOMPARE(pinchHandler->scale(), root->property("pinchScale").toReal());
+ QCOMPARE(pinchHandler->scale(), pinchHandler->activeScale()); // in sync for the first gesture
+ QPointF expectedCentroid = p0 + (p1 - p0) / 2;
QCOMPARE(pinchHandler->centroid().scenePosition(), expectedCentroid);
}
- // scale beyond bound
- p1 += QPoint(20, 20);
- {
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, touchscreen);
- pinchSequence.stationary(0).move(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
- QCOMPARE(blackRect->scale(), qreal(4)); // qquickpinchhandler does not manipulate scale property
- pinchSequence.release(0, p0, window).release(1, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ qreal lastScale = pinchHandler->scale();
+ pinchSequence.release(0, p0, &window).release(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ if (lcPointerTests().isDebugEnabled()) QTest::qWait(500);
+ // scale property is persistent after release
+ QCOMPARE(pinchHandler->scale(), lastScale);
+
+ // pinch a second time: scale picks up where we left off
+ p0 = QPoint(80, 80);
+ p1 = QPoint(100, 100);
+ pinchSequence.press(0, p0, &window).press(1, p1, &window).commit();
+ // move one point until PinchHandler activates
+ for (int pi = 0; pi < 10 && !pinchHandler->active(); ++pi) {
+ p1 += pd;
+ pinchSequence.stationary(0).move(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ }
+ if (lcPointerTests().isDebugEnabled()) QTest::qWait(500);
+ QCOMPARE(pinchHandler->active(), true);
+ QCOMPARE(pinchHandler->scale(), lastScale); // just activated, not scaling further yet
+ for (int i = 0; i < 2; ++i) {
+ lastScale = pinchHandler->scale();
+ p1 += pd;
+ pinchSequence.stationary(0).move(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ if (lcPointerTests().isDebugEnabled()) QTest::qWait(500);
+ QVERIFY(pinchHandler->scale() > lastScale);
+ line.setP2(p1);
+ qreal expectedActiveScale = line.length() / startLength;
+ QVERIFY(qFloatDistance(pinchHandler->activeScale(), expectedActiveScale) < 10);
+ QCOMPARE(pinchHandler->scale(), root->property("pinchScale").toReal());
+ QVERIFY(pinchHandler->scale() != pinchHandler->activeScale()); // not in sync anymore
}
+
+ // scale beyond maximumScale
+ p1 = QPoint(310, 310);
+ pinchSequence.stationary(0).move(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
+ if (lcPointerTests().isDebugEnabled()) QTest::qWait(500);
+ QCOMPARE(blackRect->scale(), qreal(4));
+ QCOMPARE(pinchHandler->scale(), qreal(4)); // limited by maximumScale
+ pinchSequence.release(0, p0, &window).release(1, p1, &window).commit();
+ QQuickTouchUtils::flush(&window);
QCOMPARE(pinchHandler->active(), false);
}
@@ -492,7 +522,7 @@ void tst_QQuickPinchHandler::pan()
pinchSequence.stationary(0).press(1, p1, window).commit();
QQuickTouchUtils::flush(window);
QVERIFY(!root->property("pinchActive").toBool());
- QCOMPARE(root->property("scale").toReal(), -1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), -1.0);
p0 += QPoint(dragThreshold, 0);
p1 += QPoint(dragThreshold, 0);
@@ -500,7 +530,7 @@ void tst_QQuickPinchHandler::pan()
QQuickTouchUtils::flush(window);
// movement < dragThreshold: pinchHandler not yet active
QVERIFY(!root->property("pinchActive").toBool());
- QCOMPARE(root->property("scale").toReal(), -1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), -1.0);
// just above the dragThreshold: pinchHandler starts
p0 += QPoint(1, 0);
@@ -508,7 +538,7 @@ void tst_QQuickPinchHandler::pan()
pinchSequence.move(0, p0, window).move(1, p1, window).commit();
QQuickTouchUtils::flush(window);
QCOMPARE(pinchHandler->active(), true);
- QCOMPARE(root->property("scale").toReal(), 1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), 1.0);
// Calculation of the center point is tricky at first:
// center point of the two touch points in item coordinates:
@@ -675,7 +705,7 @@ void tst_QQuickPinchHandler::retouch()
pinchSequence.move(0, p0,window).move(1, p1,window).commit();
QQuickTouchUtils::flush(window);
- QCOMPARE(root->property("scale").toReal(), 1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), 1.0);
QCOMPARE(pinchHandler->active(), true);
p0 -= delta;
@@ -686,7 +716,7 @@ void tst_QQuickPinchHandler::retouch()
QCOMPARE(pinchHandler->active(), true);
// accept some slack
- QVERIFY(withinBounds(1.4, root->property("scale").toReal(), 1.6));
+ QVERIFY(withinBounds(1.4, root->property("pinchScale").toReal(), 1.6));
QCOMPARE(pinchHandler->centroid().position().toPoint(), QPoint(40, 40)); // blackrect is at 50,50
QVERIFY(withinBounds(1.4, blackRect->scale(), 1.6));
@@ -761,7 +791,7 @@ void tst_QQuickPinchHandler::cancel()
pinchSequence.move(0, p0,window).move(1, p1,window).commit();
QQuickTouchUtils::flush(window);
- QCOMPARE(root->property("scale").toReal(), 1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), 1.0);
QCOMPARE(pinchHandler->active(), true);
p0 -= delta;
@@ -769,7 +799,7 @@ void tst_QQuickPinchHandler::cancel()
pinchSequence.move(0, p0,window).move(1, p1,window).commit();
QQuickTouchUtils::flush(window);
- QVERIFY(withinBounds(1.4, root->property("scale").toReal(), 1.6));
+ QVERIFY(withinBounds(1.4, root->property("pinchScale").toReal(), 1.6));
QCOMPARE(pinchHandler->centroid().position().toPoint(), QPoint(40, 40)); // blackrect is at 50,50
QVERIFY(withinBounds(1.4, blackRect->scale(), 1.6));
@@ -779,7 +809,7 @@ void tst_QQuickPinchHandler::cancel()
QCoreApplication::sendEvent(window, &cancelEvent);
QQuickTouchUtils::flush(window);
- QCOMPARE(root->property("scale").toReal(), 1.0);
+ QCOMPARE(root->property("pinchScale").toReal(), 1.0);
QCOMPARE(root->property("center").toPoint(), QPoint(40, 40)); // blackrect is at 50,50
QCOMPARE(blackRect->scale(), 1.0);
QVERIFY(!root->property("pinchActive").toBool());
diff --git a/tests/auto/quick/qquickdeliveryagent/data/listViewDelegate.qml b/tests/auto/quick/qquickdeliveryagent/data/listViewDelegate.qml
new file mode 100644
index 0000000000..bdb7246450
--- /dev/null
+++ b/tests/auto/quick/qquickdeliveryagent/data/listViewDelegate.qml
@@ -0,0 +1,21 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQuick
+
+Item {
+ id: root
+ width: 320
+ height: 240
+
+ ListView {
+ id: listView
+ width: 320
+ height: 240
+ delegate: Rectangle {
+ width: ListView.view.width
+ height: ListView.view.height / ListView.view.count
+ color: "tomato"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp
index a9d6c426f6..d0e29b3a65 100644
--- a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp
+++ b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp
@@ -35,6 +35,7 @@
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickWindow>
#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuick/private/qquicklistview_p.h>
#include <QtQuick/private/qquickpointhandler_p.h>
#include <QtQuick/private/qquickshadereffectsource_p.h>
#include <QtQuick/private/qquicktaphandler_p.h>
@@ -154,6 +155,7 @@ public:
private slots:
void passiveGrabberOrder();
void tapHandlerDoesntOverrideSubsceneGrabber();
+ void undoDelegationWhenSubsceneFocusCleared();
void touchCompression();
void hoverPropagation_nested_data();
void hoverPropagation_nested();
@@ -249,6 +251,31 @@ void tst_qquickdeliveryagent::tapHandlerDoesntOverrideSubsceneGrabber() // QTBUG
QCOMPARE(clickSpy.count(), 0); // doesn't tap
}
+void tst_qquickdeliveryagent::undoDelegationWhenSubsceneFocusCleared() // QTBUG-105192
+{
+ QQuickView window;
+#ifdef DISABLE_HOVER_IN_IRRELEVANT_TESTS
+ QQuickWindowPrivate::get(&window)->deliveryAgentPrivate()->frameSynchronousHoverEnabled = false;
+#endif
+ QVERIFY(QQuickTest::initView(window, testFileUrl("listViewDelegate.qml")));
+ QQuickListView *listView = window.rootObject()->findChild<QQuickListView*>();
+ QVERIFY(listView);
+
+ // put the ListView into a SubsceneRootItem
+ SubsceneRootItem subscene(listView, listView->boundingRect(), window.rootObject());
+
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ // populate a delegate in ListView
+ listView->setModel(1);
+ QQuickItem *delegate = nullptr;
+ QTRY_VERIFY(QQuickVisualTestUtils::findViewDelegateItem(listView, 0, delegate));
+ QCOMPARE(QQuickWindowPrivate::get(&window)->deliveryAgentPrivate()->activeFocusItem, delegate);
+ delete listView;
+ QVERIFY(QQuickWindowPrivate::get(&window)->deliveryAgentPrivate()->activeFocusItem != delegate);
+}
+
void tst_qquickdeliveryagent::touchCompression()
{
QQuickView window;
diff --git a/tests/auto/quick/qquickdroparea/data/ignoreRetriggerEvent.qml b/tests/auto/quick/qquickdroparea/data/ignoreRetriggerEvent.qml
new file mode 100644
index 0000000000..af25a04ee7
--- /dev/null
+++ b/tests/auto/quick/qquickdroparea/data/ignoreRetriggerEvent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+DropArea {
+ property int enterEvents: 0
+ property int exitEvents: 0
+ width: 100; height: 100
+ objectName: "dropArea"
+ onEntered: function (drag) { ++enterEvents; drag.accepted = false }
+ onExited: {++exitEvents}
+ Item {
+ objectName: "dragItem"
+ x: 50; y: 50
+ width: 10; height: 10
+ }
+}
diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
index 6bbe0d522b..9c9d059a52 100644
--- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
+++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
@@ -67,6 +67,9 @@ public:
private slots:
void containsDrag_internal();
void containsDrag_external();
+
+ void ignoreRetriggerEvent();
+
void keys_internal();
void keys_external();
void source_internal();
@@ -829,6 +832,32 @@ void tst_QQuickDropArea::competingDrags()
QCOMPARE(evaluate<QString>(dropArea1, "statuslol"), QStringLiteral("parent"));
}
+void tst_QQuickDropArea::ignoreRetriggerEvent()
+{
+ QQuickView window;
+ QByteArray errorMessage;
+ QVERIFY2(QQuickTest::initView(window, testFileUrl("ignoreRetriggerEvent.qml"), true, &errorMessage), errorMessage.constData());
+
+ QQuickItem *dropArea = window.rootObject();
+ QVERIFY(dropArea);
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ // Drag the item within the drop area
+ dragItem->setPosition(QPointF(25, 25));
+ QCoreApplication::processEvents();
+ dragItem->setPosition(QPointF(50, 50));
+ QCoreApplication::processEvents();
+ dragItem->setPosition(QPointF(75, 75));
+ QCoreApplication::processEvents();
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+}
+
+
void tst_QQuickDropArea::simultaneousDrags()
{
QQuickWindow window;
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index c088be4566..a6fb0fcb59 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -207,6 +207,7 @@ private slots:
void movingAndDragging_data();
void flickOnRelease();
void pressWhileFlicking();
+ void dragWhileFlicking();
void disabled();
void flickVelocity();
void margins();
@@ -1483,6 +1484,8 @@ void tst_qquickflickable::pressWhileFlicking()
QSignalSpy hFlickSpy(flickable, SIGNAL(flickingHorizontallyChanged()));
QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged()));
QSignalSpy flickSpy(flickable, SIGNAL(flickingChanged()));
+ QSignalSpy flickStartSpy(flickable, &QQuickFlickable::flickStarted);
+ QSignalSpy flickEndSpy(flickable, &QQuickFlickable::flickEnded);
// flick then press while it is still moving
// flicking == false, moving == true;
@@ -1500,6 +1503,8 @@ void tst_qquickflickable::pressWhileFlicking()
QCOMPARE(vFlickSpy.count(), 1);
QCOMPARE(hFlickSpy.count(), 0);
QCOMPARE(flickSpy.count(), 1);
+ QCOMPARE(flickStartSpy.count(), 1);
+ QCOMPARE(flickEndSpy.count(), 0);
QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 50));
QTRY_VERIFY(!flickable->isFlicking());
@@ -1512,6 +1517,76 @@ void tst_qquickflickable::pressWhileFlicking()
QVERIFY(!flickable->isFlickingVertically());
QTRY_VERIFY(!flickable->isMoving());
QVERIFY(!flickable->isMovingVertically());
+ QCOMPARE(flickStartSpy.size(), 1);
+ QCOMPARE(flickEndSpy.size(), 1);
+ // Stop on a full pixel after user interaction
+ QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
+}
+
+void tst_qquickflickable::dragWhileFlicking()
+{
+ QQuickView window;
+ QVERIFY(QQuickTest::showView(window, testFileUrl("flickable03.qml")));
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window.rootObject());
+ QVERIFY(flickable != nullptr);
+
+ QSignalSpy vMoveSpy(flickable, &QQuickFlickable::movingVerticallyChanged);
+ QSignalSpy hMoveSpy(flickable, &QQuickFlickable::movingHorizontallyChanged);
+ QSignalSpy moveSpy(flickable, &QQuickFlickable::movingChanged);
+ QSignalSpy hFlickSpy(flickable, &QQuickFlickable::flickingHorizontallyChanged);
+ QSignalSpy vFlickSpy(flickable, &QQuickFlickable::flickingVerticallyChanged);
+ QSignalSpy flickSpy(flickable, &QQuickFlickable::flickingChanged);
+ QSignalSpy flickStartSpy(flickable, &QQuickFlickable::flickStarted);
+ QSignalSpy flickEndSpy(flickable, &QQuickFlickable::flickEnded);
+
+ // flick first, let it keep moving
+ flick(&window, QPoint(20,190), QPoint(20, 50), 200);
+ QVERIFY(flickable->verticalVelocity() > 0.0);
+ QTRY_VERIFY(flickable->isFlicking());
+ QVERIFY(flickable->isFlickingVertically());
+ QCOMPARE(flickable->isFlickingHorizontally(), false);
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isMovingVertically());
+ QCOMPARE(flickable->isMovingHorizontally(), false);
+ QCOMPARE(vMoveSpy.size(), 1);
+ QCOMPARE(hMoveSpy.size(), 0);
+ QCOMPARE(moveSpy.size(), 1);
+ QCOMPARE(vFlickSpy.size(), 1);
+ QCOMPARE(hFlickSpy.size(), 0);
+ QCOMPARE(flickSpy.size(), 1);
+ QCOMPARE(flickStartSpy.size(), 1);
+ QCOMPARE(flickEndSpy.size(), 0);
+
+ // then drag slowly while it's still flicking and moving
+ const int dragStepDelay = 100;
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(20, 70));
+ QTRY_COMPARE(flickable->isFlicking(), false);
+ QCOMPARE(flickable->isFlickingVertically(), false);
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isMovingVertically());
+
+ for (int y = 70; y > 50; y -= 5) {
+ QTest::mouseMove(&window, QPoint(20, y), dragStepDelay);
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isMovingVertically());
+ // Flickable's timeline is real-time, so spoofing timestamps isn't enough
+ QTest::qWait(dragStepDelay);
+ }
+
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(20, 50), dragStepDelay);
+
+ QCOMPARE(flickable->isFlicking(), false);
+ QCOMPARE(flickable->isFlickingVertically(), false);
+ QTRY_COMPARE(flickable->isMoving(), false);
+ QCOMPARE(flickable->isMovingVertically(), false);
+ QCOMPARE(flickStartSpy.size(), 1);
+ QCOMPARE(flickEndSpy.size(), 1);
+ QCOMPARE(vMoveSpy.size(), 2);
+ QCOMPARE(hMoveSpy.size(), 0);
+ QCOMPARE(moveSpy.size(), 2);
+ QCOMPARE(vFlickSpy.size(), 2);
+ QCOMPARE(hFlickSpy.size(), 0);
// Stop on a full pixel after user interaction
QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
}
diff --git a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
index 46d18a4384..1abf2787b7 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
@@ -586,6 +586,56 @@ Item {
tryCompare(layout.children[4], "y", 60);
}
+ Component {
+ id: layout_alignBaseline_Component
+ GridLayout {
+ columns: 2
+ columnSpacing: 0
+ rowSpacing: 0
+ TextInput {
+ property var itemRect: [x, y, width, height]
+ text: "red"
+ baselineOffset: 7
+ color: "red"
+ verticalAlignment: TextInput.AlignVCenter
+ Layout.preferredWidth: 50
+ Layout.preferredHeight: 10
+ Layout.fillHeight: true
+ }
+ TextInput {
+ property var itemRect: [x, y, width, height]
+ text: "green"
+ baselineOffset: 7
+ color: "green"
+ verticalAlignment: TextInput.AlignVCenter
+ Layout.preferredWidth: 50
+ Layout.preferredHeight: 10
+ Layout.fillHeight: true
+ }
+
+ }
+ }
+
+ function test_alignBaseline_dont_always_invalidate()
+ {
+ var layout = createTemporaryObject(layout_alignBaseline_Component, container);
+ waitForItemPolished(layout)
+ layout.height = 20
+ // Adjusting height on an item that uses Qt.AlignBaseline might adjust the baseline
+ // Test if we don't get excessive number of polish() events because of baseline changes
+ // (In this case, we don't want to align by the baseline)
+ compare(isPolishScheduled(layout), false)
+ waitForItemPolished(layout)
+ var c0 = layout.children[0]
+ c0.Layout.alignment = Qt.AlignBaseline
+ var c1 = layout.children[1]
+ c1.Layout.alignment = Qt.AlignBaseline
+
+ // We want to align by baseline => expect a polish event
+ compare(isPolishScheduled(layout), true)
+ waitForItemPolished(layout)
+ }
+
Component {
id: layout_rightToLeft_Component
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 87e0a01df2..5e8f6f9bcf 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -77,6 +77,18 @@ Item {
}
Component {
+ id: layout_rowLayout_Component
+ RowLayout {
+ }
+ }
+
+ Component {
+ id: layout_columnLayout_Component
+ ColumnLayout {
+ }
+ }
+
+ Component {
id: itemsWithAnchorsLayout_Component
RowLayout {
spacing: 2
@@ -532,6 +544,102 @@ Item {
layout.destroy();
}
+
+ function buildLayout(layout, arrLayoutData) {
+ for (let i = 0; i < arrLayoutData.length; i++) {
+ let layoutItemDesc = arrLayoutData[i]
+ let rect = layoutItem_Component.createObject(layout)
+ for (let keyName in layoutItemDesc) {
+ rect.Layout[keyName] = layoutItemDesc[keyName]
+ }
+ }
+ }
+
+ function test_dynamicAlignment_data()
+ {
+ return [
+ {
+ tag: "simple",
+
+ layout: {
+ type: "RowLayout",
+ items: [
+ {preferredWidth: 30, preferredHeight: 20, fillHeight: true},
+ {preferredWidth: 30, preferredHeight: 20},
+ ]
+ },
+ expectedGeometries: [
+ [ 0, 0, 30, 60],
+ [30, 20, 30, 20]
+ ]
+ },{
+ tag: "valign",
+ layout: {
+ type: "RowLayout",
+ items: [
+ {preferredWidth: 12, preferredHeight: 20, fillHeight: true},
+ {preferredWidth: 12, preferredHeight: 20},
+ {preferredWidth: 12, preferredHeight: 20, alignment: Qt.AlignTop},
+ {preferredWidth: 12, preferredHeight: 20, alignment: Qt.AlignVCenter},
+ {preferredWidth: 12, preferredHeight: 20, alignment: Qt.AlignBottom}
+ ]
+ },
+ expectedGeometries: [
+ [ 0, 0, 12, 60],
+ [12, 20, 12, 20],
+ [24, 0, 12, 20],
+ [36, 20, 12, 20],
+ [48, 40, 12, 20]
+ ]
+ },{
+ tag: "halign",
+ layout: {
+ type: "ColumnLayout",
+ items: [
+ {preferredWidth: 20, preferredHeight: 12, fillWidth: true},
+ {preferredWidth: 20, preferredHeight: 12},
+ {preferredWidth: 20, preferredHeight: 12, alignment: Qt.AlignLeft},
+ {preferredWidth: 20, preferredHeight: 12, alignment: Qt.AlignHCenter},
+ {preferredWidth: 20, preferredHeight: 12, alignment: Qt.AlignRight}
+ ]
+ },
+ expectedGeometries: [
+ [ 0, 0, 60, 12],
+ [ 0, 12, 20, 12],
+ [ 0, 24, 20, 12],
+ [20, 36, 20, 12],
+ [40, 48, 20, 12]
+ ]
+ }
+ ]
+ }
+
+ function test_dynamicAlignment(data)
+ {
+ let layout
+ switch (data.layout.type) {
+ case "RowLayout":
+ layout = createTemporaryObject(layout_rowLayout_Component, container)
+ break
+ case "ColumnLayout":
+ layout = createTemporaryObject(layout_columnLayout_Component, container)
+ break
+ default:
+ console.log("data.layout.type not recognized(" + data.layout.type + ")")
+ }
+ layout.spacing = 0
+ buildLayout(layout, data.layout.items)
+ layout.width = 60
+ layout.height = 60 // divides in 1/2/3/4/5/6
+ waitForItemPolished(layout)
+
+ for (let i = 0; i < layout.children.length; ++i) {
+ let itm = layout.children[i]
+ compare(itemRect(itm), data.expectedGeometries[i])
+ }
+ }
+
+
Component {
id: layout_sizeHintNormalization_Component
GridLayout {
@@ -775,13 +883,6 @@ Item {
layout.destroy();
}
-
- Component {
- id: layout_rowLayout_Component
- RowLayout {
- }
- }
-
function test_stretchItem_data()
{
return [
diff --git a/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
index 6598e35990..303a4228a1 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
@@ -323,5 +323,416 @@ Item {
layout.destroy()
}
+ function geometry(item) {
+ return [item.x, item.y, item.width, item.height]
+ }
+
+ Component {
+ id: countGeometryChanges_Component
+ StackLayout {
+ id: stack
+ property alias col: _col
+ property alias row: _row
+ width: 100
+ ColumnLayout {
+ id: _col
+ property alias r1: _r1
+ property alias r2: _r2
+ property alias r3: _r3
+ spacing: 0
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ Rectangle {
+ id: _r1
+ implicitWidth: 20
+ implicitHeight: 20
+ Layout.fillWidth: true
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ }
+ Rectangle {
+ id: _r2
+ implicitWidth: 50
+ implicitHeight: 50
+ Layout.fillWidth: true
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ }
+ Rectangle {
+ id: _r3
+ implicitWidth: 40
+ implicitHeight: 40
+ Layout.fillWidth: true
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ }
+ }
+ RowLayout {
+ id: _row
+ property alias r5: _r5
+ spacing: 0
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ Rectangle {
+ id: _r5
+ implicitWidth: 100
+ implicitHeight: 100
+ Layout.fillWidth: true
+ property int counter : 0
+ onWidthChanged: { ++counter; }
+ }
+ }
+ }
+ }
+
+ function test_countGeometryChanges() {
+
+ var stack = countGeometryChanges_Component.createObject(container)
+ compare(stack.currentIndex, 0)
+ compare(stack.col.width, 100)
+ compare(stack.col.height, 110)
+ compare(stack.row.width, 100)
+ compare(stack.row.height, 100)
+ verify(stack.col.r1.counter <= 2)
+ compare(stack.col.r2.counter, 1)
+ verify(stack.col.r3.counter <= 2)
+ verify(stack.col.counter <= 2)
+ compare(stack.row.counter, 1) // not visible, will only receive the initial geometry change
+ compare(stack.row.r5.counter, 0)
+ stack.destroy()
+ }
+
+
+ Component {
+ id: layoutItem_Component
+ Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ }
+ }
+
+ Component {
+ id: emtpy_StackLayout_Component
+ StackLayout {
+ property int num_onCountChanged: 0
+ property int num_onCurrentIndexChanged: 0
+ onCountChanged: { ++num_onCountChanged; }
+ onCurrentIndexChanged: { ++num_onCurrentIndexChanged; }
+ }
+ }
+
+ function test_addAndRemoveItems()
+ {
+ var stack = emtpy_StackLayout_Component.createObject(container)
+ stack.currentIndex = 2
+ compare(stack.implicitWidth, 0)
+ compare(stack.implicitHeight, 0)
+
+ var rect0 = layoutItem_Component.createObject(stack)
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 20)
+ compare(stack.implicitHeight, 20)
+ compare(rect0.visible, false)
+
+ var rect1 = layoutItem_Component.createObject(stack)
+ rect1.Layout.preferredWidth = 30
+ rect1.Layout.preferredHeight = 10
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 30)
+ compare(stack.implicitHeight, 20)
+ compare(rect0.visible, false)
+ compare(rect1.visible, false)
+
+ var rect2 = layoutItem_Component.createObject(stack)
+ rect2.x = 42 // ### items in a stacklayout will have their x and y positions discarded.
+ rect2.y = 42
+ rect2.Layout.preferredWidth = 80
+ rect2.Layout.preferredHeight = 30
+ rect2.Layout.fillWidth = true
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 80)
+ compare(stack.implicitHeight, 30)
+ compare(rect0.visible, false)
+ compare(rect1.visible, false)
+ compare(rect2.visible, true)
+ compare(geometry(rect2), geometry(stack))
+
+ rect2.destroy()
+ wait(0)
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 30)
+ compare(stack.implicitHeight, 20)
+
+ rect0.destroy()
+ wait(0)
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 30)
+ compare(stack.implicitHeight, 10)
+
+ rect1.destroy()
+ wait(0)
+ verify(waitForItemPolished(stack))
+ compare(stack.implicitWidth, 0)
+ compare(stack.implicitHeight, 0)
+
+ stack.destroy()
+ }
+
+ function test_sizeHint_data() {
+ return [
+ { tag: "propagateNone", layoutHints: [10, 20, 30], childHints: [11, 21, 31], expected:[10, 20, Number.POSITIVE_INFINITY]},
+ { tag: "propagateMinimumWidth", layoutHints: [-1, 20, 30], childHints: [10, 21, 31], expected:[10, 20, Number.POSITIVE_INFINITY]},
+ { tag: "propagatePreferredWidth", layoutHints: [10, -1, 30], childHints: [11, 20, 31], expected:[10, 20, Number.POSITIVE_INFINITY]},
+ { tag: "propagateMaximumWidth", layoutHints: [10, 20, -1], childHints: [11, 21, 30], expected:[10, 20, Number.POSITIVE_INFINITY]},
+ { tag: "propagateAll", layoutHints: [-1, -1, -1], childHints: [10, 20, 30], expected:[10, 20, Number.POSITIVE_INFINITY]},
+ { tag: "propagateCrazy", layoutHints: [-1, -1, -1], childHints: [40, 21, 30], expected:[30, 30, Number.POSITIVE_INFINITY]},
+ { tag: "expandMinToExplicitPref", layoutHints: [-1, 1, -1], childHints: [11, 21, 31], expected:[ 1, 1, Number.POSITIVE_INFINITY]},
+ { tag: "expandMaxToExplicitPref", layoutHints: [-1, 99, -1], childHints: [11, 21, 31], expected:[11, 99, Number.POSITIVE_INFINITY]},
+ { tag: "expandAllToExplicitMin", layoutHints: [99, -1, -1], childHints: [11, 21, 31], expected:[99, 99, Number.POSITIVE_INFINITY]},
+ { tag: "expandPrefToExplicitMin", layoutHints: [24, -1, -1], childHints: [11, 21, 31], expected:[24, 24, Number.POSITIVE_INFINITY]},
+ { tag: "boundPrefToExplicitMax", layoutHints: [-1, -1, 19], childHints: [11, 21, 31], expected:[11, 19, Number.POSITIVE_INFINITY]},
+ { tag: "boundAllToExplicitMax", layoutHints: [-1, -1, 9], childHints: [11, 21, 31], expected:[ 9, 9, Number.POSITIVE_INFINITY]},
+ ];
+ }
+
+ function itemSizeHints(item) {
+ return [item.Layout.minimumWidth, item.implicitWidth, item.Layout.maximumWidth]
+ }
+ Component {
+ id: stacklayout_sizeHint_Component
+ StackLayout {
+ property int implicitWidthChangedCount : 0
+ onImplicitWidthChanged: { ++implicitWidthChangedCount }
+ ColumnLayout {
+ Rectangle {
+ id: r1
+ color: "red"
+ Layout.minimumWidth: 1
+ Layout.preferredWidth: 2
+ Layout.maximumWidth: 3
+
+ Layout.minimumHeight: 20
+ Layout.preferredHeight: 20
+ Layout.maximumHeight: 20
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ function test_sizeHint(data) {
+ var layout = stacklayout_sizeHint_Component.createObject(container)
+
+ var col = layout.children[0]
+ col.Layout.minimumWidth = data.layoutHints[0]
+ col.Layout.preferredWidth = data.layoutHints[1]
+ col.Layout.maximumWidth = data.layoutHints[2]
+
+ var child = col.children[0]
+ if (data.implicitWidth !== undefined) {
+ child.implicitWidth = data.implicitWidth
+ }
+ child.Layout.minimumWidth = data.childHints[0]
+ child.Layout.preferredWidth = data.childHints[1]
+ child.Layout.maximumWidth = data.childHints[2]
+
+ verify(waitForItemPolished(layout))
+ var effectiveSizeHintResult = [layout.Layout.minimumWidth, layout.implicitWidth, layout.Layout.maximumWidth]
+ compare(effectiveSizeHintResult, data.expected)
+ layout.destroy()
+ }
+
+ Component {
+ id: stacklayout_addIgnoredItem_Component
+ StackLayout {
+ Repeater {
+ id: rep
+ model: 1
+ Rectangle {
+ id: r
+ }
+ }
+ }
+ }
+
+ // Items with no size information is ignored.
+ function test_addIgnoredItem()
+ {
+ var stack = stacklayout_addIgnoredItem_Component.createObject(container)
+ compare(stack.count, 1)
+ compare(stack.implicitWidth, 0)
+ compare(stack.implicitHeight, 0)
+ var r = stack.children[0]
+ r.Layout.preferredWidth = 20
+ r.Layout.preferredHeight = 30
+ verify(waitForItemPolished(stack))
+ compare(stack.count, 1)
+ compare(stack.implicitWidth, 20)
+ compare(stack.implicitHeight, 30)
+ stack.destroy();
+ }
+
+ function test_dontCrashWhenAnchoredToAWindow() {
+ var test_layoutStr =
+ 'import QtQuick; \
+ import QtQuick.Window; \
+ import QtQuick.Layouts; \
+ Window { \
+ visible: true; \
+ width: stack.implicitWidth; \
+ height: stack.implicitHeight; \
+ StackLayout { \
+ id: stack; \
+ currentIndex: 0; \
+ anchors.fill: parent; \
+ Rectangle { \
+ color: "red"; \
+ implicitWidth: 300; \
+ implicitHeight: 200; \
+ } \
+ } \
+ } '
+
+ var win = Qt.createQmlObject(test_layoutStr, container, '');
+ if (win.visibility === Window.Windowed) {
+ // on single-window systems (such as Android), the window geometry will be
+ // fullscreen, and most likely it will be set to screen size. Avoid this test for
+ // those systems, as the size of the window will not be determined by the layout
+ tryCompare(win, 'width', 300);
+ }
+ win.destroy()
+ }
+
+ Component {
+ id: test_dontCrashWhenChildIsResizedToNull_Component
+ StackLayout {
+ property alias rect : _rect
+ Rectangle {
+ id: _rect;
+ color: "red"
+ implicitWidth: 200
+ implicitHeight: 200
+ }
+ }
+ }
+
+ function test_dontCrashWhenChildIsResizedToNull() {
+ var layout = test_dontCrashWhenChildIsResizedToNull_Component.createObject(container)
+ layout.rect.width = 0
+ layout.width = 222 // trigger a rearrange with a valid size
+ layout.height = 222
+ }
+
+ Component {
+ id: test_currentIndex_Component
+ StackLayout {
+ currentIndex: 1
+ Text {
+ text: "0"
+ }
+ Text {
+ text: "1"
+ }
+ }
+ }
+
+ function test_currentIndex() {
+ var layout = test_currentIndex_Component.createObject(container)
+ var c0 = layout.children[0]
+ var c1 = layout.children[1]
+ compare(layout.currentIndex, 1)
+ tryCompare(layout, 'visible', true)
+ compare(c0.visible, false)
+ compare(c1.visible, true)
+ layout.currentIndex = 0
+ compare(c0.visible, true)
+ compare(c1.visible, false)
+ var c2 = layoutItem_Component.createObject(layout)
+ compare(c2.visible, false)
+
+ /*
+ * destroy the current item and check if visibility advances to next
+ */
+ c0.destroy()
+ tryCompare(c1, 'visible', true)
+ compare(c2.visible, false)
+ c1.destroy()
+ tryCompare(c2, 'visible', true)
+ c2.destroy()
+ tryCompare(layout, 'currentIndex', 0)
+
+ layout.destroy()
+
+ /*
+ * Test the default/implicit value of currentIndex, either -1 (if empty) or 0:
+ */
+ layout = emtpy_StackLayout_Component.createObject(container)
+ tryCompare(layout, 'visible', true)
+ compare(layout.currentIndex, -1)
+ compare(layout.num_onCurrentIndexChanged, 0)
+ // make it non-empty
+ c0 = layoutItem_Component.createObject(layout)
+ compare(layout.currentIndex, 0)
+ compare(layout.num_onCurrentIndexChanged, 1)
+ compare(c0.visible, true)
+ // make it empty again
+ c0.destroy()
+ wait(0)
+ compare(layout.currentIndex, -1)
+ //tryCompare(layout, 'currentIndex', -1)
+ compare(layout.num_onCurrentIndexChanged, 2)
+
+ /*
+ * Check that explicit value doesn't change,
+ * and that no items are visible if the index is invalid/out of range
+ */
+ layout.currentIndex = 2
+ compare(layout.currentIndex, 2)
+ compare(layout.num_onCurrentIndexChanged, 3)
+ c0 = layoutItem_Component.createObject(layout)
+ compare(layout.currentIndex, 2)
+ compare(c0.visible, false)
+
+ c1 = layoutItem_Component.createObject(layout)
+ compare(layout.currentIndex, 2)
+ compare(c0.visible, false)
+ compare(c1.visible, false)
+
+ c2 = layoutItem_Component.createObject(layout)
+ compare(layout.currentIndex, 2)
+ compare(c0.visible, false)
+ compare(c1.visible, false)
+ compare(c2.visible, true)
+
+ c2.destroy()
+ wait(0)
+ compare(layout.currentIndex, 2)
+ compare(c0.visible, false)
+ compare(c1.visible, false)
+ c1.destroy()
+ wait(0)
+ compare(layout.currentIndex, 2)
+ compare(c0.visible, false)
+ c0.destroy()
+ wait(0)
+ compare(layout.currentIndex, 2)
+ compare(layout.num_onCurrentIndexChanged, 3)
+ }
+
+ function test_count() {
+ var layout = emtpy_StackLayout_Component.createObject(container)
+ tryCompare(layout, 'visible', true)
+ compare(layout.count, 0)
+ compare(layout.currentIndex, -1)
+ compare(layout.num_onCountChanged, 0)
+ compare(layout.num_onCurrentIndexChanged, 0)
+ var c0 = layoutItem_Component.createObject(layout)
+ compare(layout.count, 1)
+ compare(layout.currentIndex, 0)
+ compare(layout.num_onCurrentIndexChanged, 1)
+ compare(layout.num_onCountChanged, 1)
+ }
+
+
}
}
diff --git a/tests/auto/quick/qquickloader/data/overflow.qml b/tests/auto/quick/qquickloader/data/overflow.qml
new file mode 100644
index 0000000000..e5fdfee182
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/overflow.qml
@@ -0,0 +1,5 @@
+import QtQuick
+
+Loader {
+ source: "overflow.qml"
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index 4bb98db003..620ada57db 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -135,6 +135,8 @@ private slots:
void setSourceAndCheckStatus();
void asyncLoaderRace();
void noEngine();
+
+ void stackOverflow();
};
Q_DECLARE_METATYPE(QList<QQmlError>)
@@ -1548,6 +1550,17 @@ void tst_QQuickLoader::noEngine()
QTRY_COMPARE(o->property("changes").toInt(), 1);
}
+void tst_QQuickLoader::stackOverflow()
+{
+ QQmlEngine engine;
+ const QUrl url = testFileUrl("overflow.qml");
+ QQmlComponent component(&engine, url);
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ const QString message = url.toString() + QStringLiteral(": Maximum call stack size exceeded.");
+ QTest::ignoreMessage(QtCriticalMsg, qPrintable(message));
+ QScopedPointer<QObject> o(component.create());
+}
+
QTEST_MAIN(tst_QQuickLoader)
#include "tst_qquickloader.moc"
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index a684b04fba..d845e9ef90 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -58,6 +58,7 @@ private slots:
void dragTransformedPinchArea_data();
void dragTransformedPinchArea();
void pinchAreaKeepsDragInView();
+ void pinchInPathView();
private:
QQuickView *createView();
@@ -732,6 +733,61 @@ void tst_QQuickPinchArea::pinchAreaKeepsDragInView()
QCOMPARE(pathView->offset(), 0);
}
+void tst_QQuickPinchArea::pinchInPathView()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("pinchAreaInPathView.qml"));
+ QVERIFY(view.rootObject());
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickPathView *pathView = qobject_cast<QQuickPathView*>(view.rootObject());
+ QVERIFY(pathView);
+ QCOMPARE(pathView->count(), 3);
+
+ const QQuickItem *pinchDelegateItem = pathView->itemAtIndex(0);
+ QQuickPinchArea *pinchArea = pinchDelegateItem->property("pinchArea").value<QQuickPinchArea*>();
+ QVERIFY(pinchArea);
+
+ // press
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(&view, device);
+ QPoint point1Start = { 10, 10 };
+ QPoint point2Start = { 100, 100 };
+ const int dragThreshold = qApp->styleHints()->startDragDistance();
+ pinchSequence.press(0, point1Start, &view)
+ .press(1, point2Start, &view)
+ .commit();
+ QQuickTouchUtils::flush(&view);
+ QTest::qWait(20);
+
+ // move
+ QPoint moveDistance = QPoint(dragThreshold * 3, dragThreshold * 3);
+ QPoint point2End = point2Start + moveDistance;
+ pinchSequence.stationary(0)
+ .move(1, point2End, &view)
+ .commit();
+ QQuickTouchUtils::flush(&view);
+ QTest::qWait(20);
+
+ point2End += moveDistance;
+ pinchSequence.stationary(0)
+ .move(1, point2End, &view)
+ .commit();
+ QQuickTouchUtils::flush(&view);
+ QTest::qWait(20);
+
+ QCOMPARE(pinchArea->pinch()->active(), true);
+ QVERIFY2(pinchDelegateItem->scale() > 1.0, qPrintable(QString::number(pinchDelegateItem->scale())));
+ // PathView shouldn't have moved.
+ QCOMPARE(pathView->offset(), 0);
+
+ // release pinch.
+ pinchSequence.release(0, point1Start, &view).release(1, point2End, &view).commit();
+ QQuickTouchUtils::flush(&view);
+ QCOMPARE(pinchArea->pinch()->active(), false);
+ QCOMPARE(pathView->offset(), 0);
+}
+
QQuickView *tst_QQuickPinchArea::createView()
{
QQuickView *window = new QQuickView(nullptr);
diff --git a/tests/auto/quick/qquicktableview/data/syncviewsimple.qml b/tests/auto/quick/qquicktableview/data/syncviewsimple.qml
index 012cceaa9d..fc75e97a0f 100644
--- a/tests/auto/quick/qquicktableview/data/syncviewsimple.qml
+++ b/tests/auto/quick/qquicktableview/data/syncviewsimple.qml
@@ -49,6 +49,9 @@ Item {
property alias tableViewV: tableViewV
property alias tableViewHV: tableViewHV
+ property real delegateWidth: 30
+ property real delegateHeight: 60
+
Column {
spacing: 10
TableView {
@@ -93,7 +96,7 @@ Item {
height: 100
anchors.margins: 1
clip: true
- delegate: tableViewDelegate
+ delegate: tableViewDelegateMainView
columnSpacing: 1
rowSpacing: 1
@@ -106,10 +109,27 @@ Item {
id: tableViewDelegate
Rectangle {
objectName: "tableViewDelegate"
+ color: "lightblue"
+ border.width: 1
+ implicitWidth: 100
+ implicitHeight: 100
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 10
+ text: parent.TableView.view.objectName + "\n" + column + ", " + row
+ }
+ }
+ }
+
+ Component {
+ id: tableViewDelegateMainView
+ Rectangle {
+ objectName: "tableViewDelegate"
color: "lightgray"
border.width: 1
- implicitWidth: 30
- implicitHeight: 60
+ implicitWidth: delegateWidth
+ implicitHeight: delegateHeight
Text {
anchors.centerIn: parent
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index bb9758f24e..04670837d6 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -179,10 +179,12 @@ private slots:
void checkSyncView_childViews_data();
void checkSyncView_childViews();
void checkSyncView_differentSizedModels();
+ void checkSyncView_differentGeometry();
void checkSyncView_connect_late_data();
void checkSyncView_connect_late();
void checkSyncView_pageFlicking();
void checkSyncView_emptyModel();
+ void checkSyncView_topLeftChanged();
void delegateWithRequiredProperties();
void checkThatFetchMoreIsCalledWhenScrolledToTheEndOfTable();
void replaceModel();
@@ -2642,6 +2644,18 @@ void tst_QQuickTableView::checkSyncView_rootView()
QCOMPARE(tableViewVPrivate->loadedTableOuterRect.left(), 0);
QCOMPARE(tableViewHVPrivate->loadedTableOuterRect, tableViewPrivate->loadedTableOuterRect);
+
+ // Check that the column widths are in sync
+ for (int column = tableView->leftColumn(); column < tableView->rightColumn(); ++column) {
+ QCOMPARE(tableViewH->columnWidth(column), tableView->columnWidth(column));
+ QCOMPARE(tableViewHV->columnWidth(column), tableView->columnWidth(column));
+ }
+
+ // Check that the row heights are in sync
+ for (int row = tableView->topRow(); row < tableView->bottomRow(); ++row) {
+ QCOMPARE(tableViewV->rowHeight(row), tableView->rowHeight(row));
+ QCOMPARE(tableViewHV->rowHeight(row), tableView->rowHeight(row));
+ }
}
void tst_QQuickTableView::checkSyncView_childViews_data()
@@ -2747,6 +2761,18 @@ void tst_QQuickTableView::checkSyncView_childViews()
QCOMPARE(tableViewHVPrivate->bottomRow(), tableViewPrivate->bottomRow());
QCOMPARE(tableViewHVPrivate->loadedTableOuterRect, tableViewPrivate->loadedTableOuterRect);
}
+
+ // Check that the column widths are in sync
+ for (int column = tableView->leftColumn(); column < tableView->rightColumn(); ++column) {
+ QCOMPARE(tableViewH->columnWidth(column), tableView->columnWidth(column));
+ QCOMPARE(tableViewHV->columnWidth(column), tableView->columnWidth(column));
+ }
+
+ // Check that the row heights are in sync
+ for (int row = tableView->topRow(); row < tableView->bottomRow(); ++row) {
+ QCOMPARE(tableViewV->rowHeight(row), tableView->rowHeight(row));
+ QCOMPARE(tableViewHV->rowHeight(row), tableView->rowHeight(row));
+ }
}
void tst_QQuickTableView::checkSyncView_differentSizedModels()
@@ -2812,6 +2838,61 @@ void tst_QQuickTableView::checkSyncView_differentSizedModels()
QVERIFY(tableViewHVPrivate->loadedColumns.isEmpty());
}
+void tst_QQuickTableView::checkSyncView_differentGeometry()
+{
+ // Check that you can have two tables in a syncView relation, where
+ // the sync "child" is larger than the sync view. This means that the
+ // child will display more rows and columns than the parent.
+ // In that case, the sync view will anyway need to load the same rows
+ // and columns as the child, otherwise the column and row sizes
+ // cannot be determined for the child.
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+
+ tableView->setWidth(40);
+ tableView->setHeight(40);
+
+ auto tableViewModel = TestModelAsVariant(100, 100);
+
+ tableView->setModel(tableViewModel);
+ tableViewH->setModel(tableViewModel);
+ tableViewV->setModel(tableViewModel);
+ tableViewHV->setModel(tableViewModel);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Check that the column widths are in sync
+ for (int column = tableViewH->leftColumn(); column < tableViewH->rightColumn(); ++column) {
+ QCOMPARE(tableViewH->columnWidth(column), tableView->columnWidth(column));
+ QCOMPARE(tableViewHV->columnWidth(column), tableView->columnWidth(column));
+ }
+
+ // Check that the row heights are in sync
+ for (int row = tableViewV->topRow(); row < tableViewV->bottomRow(); ++row) {
+ QCOMPARE(tableViewV->rowHeight(row), tableView->rowHeight(row));
+ QCOMPARE(tableViewHV->rowHeight(row), tableView->rowHeight(row));
+ }
+
+ // Flick a bit, and do the same test again
+ tableView->setContentX(200);
+ tableView->setContentY(200);
+ WAIT_UNTIL_POLISHED;
+
+ // Check that the column widths are in sync
+ for (int column = tableViewH->leftColumn(); column < tableViewH->rightColumn(); ++column) {
+ QCOMPARE(tableViewH->columnWidth(column), tableView->columnWidth(column));
+ QCOMPARE(tableViewHV->columnWidth(column), tableView->columnWidth(column));
+ }
+
+ // Check that the row heights are in sync
+ for (int row = tableViewV->topRow(); row < tableViewV->bottomRow(); ++row) {
+ QCOMPARE(tableViewV->rowHeight(row), tableView->rowHeight(row));
+ QCOMPARE(tableViewHV->rowHeight(row), tableView->rowHeight(row));
+ }
+}
+
void tst_QQuickTableView::checkSyncView_connect_late_data()
{
QTest::addColumn<qreal>("flickToPos");
@@ -2979,6 +3060,42 @@ void tst_QQuickTableView::checkSyncView_emptyModel()
QCOMPARE(tableViewVPrivate->loadedTableOuterRect.left(), 0);
}
+void tst_QQuickTableView::checkSyncView_topLeftChanged()
+{
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+ QQuickTableView *views[] = {tableViewH, tableViewV, tableViewHV};
+
+ auto model = TestModelAsVariant(100, 100);
+ tableView->setModel(model);
+
+ for (auto view : views)
+ view->setModel(model);
+
+ tableView->setColumnWidthProvider(QJSValue());
+ tableView->setRowHeightProvider(QJSValue());
+ view->rootObject()->setProperty("delegateWidth", 300);
+ view->rootObject()->setProperty("delegateHeight", 300);
+ tableView->forceLayout();
+
+ tableViewHV->setContentX(350);
+ tableViewHV->setContentY(350);
+
+ WAIT_UNTIL_POLISHED;
+
+ QCOMPARE(tableViewH->leftColumn(), tableView->leftColumn());
+ QCOMPARE(tableViewV->topRow(), tableView->topRow());
+
+ view->rootObject()->setProperty("delegateWidth", 50);
+ view->rootObject()->setProperty("delegateHeight", 50);
+ tableView->forceLayout();
+
+ QCOMPARE(tableViewH->leftColumn(), tableView->leftColumn());
+ QCOMPARE(tableViewV->topRow(), tableView->topRow());
+}
+
void tst_QQuickTableView::checkThatFetchMoreIsCalledWhenScrolledToTheEndOfTable()
{
LOAD_TABLEVIEW("plaintableview.qml");
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index a2cbd86123..476297918d 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -3524,6 +3524,46 @@ void tst_qquicktext::fontSizeMode()
myText->setElideMode(QQuickText::ElideNone);
QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+
+ // Growing height needs to update the baselineOffset when AlignBottom is used
+ // and text is NOT wrapped
+ myText->setVAlign(QQuickText::AlignBottom);
+ myText->setFontSizeMode(QQuickText::Fit);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+
+ int baselineOffset = myText->baselineOffset();
+ myText->setHeight(myText->height() * 2);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ QVERIFY(myText->baselineOffset() > baselineOffset);
+
+ // Growing height needs to update the baselineOffset when AlignBottom is used
+ // and the text is wrapped
+ myText->setVAlign(QQuickText::AlignBottom);
+ myText->setFontSizeMode(QQuickText::Fit);
+ myText->setWrapMode(QQuickText::NoWrap);
+ myText->resetMaximumLineCount();
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+
+ baselineOffset = myText->baselineOffset();
+ myText->setHeight(myText->height() * 2);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ QVERIFY(myText->baselineOffset() > baselineOffset);
+
+ // Check baselineOffset for the HorizontalFit case
+ myText->setVAlign(QQuickText::AlignBottom);
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ QSignalSpy baselineOffsetSpy(myText, SIGNAL(baselineOffsetChanged(qreal)));
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ const qreal oldBaselineOffset = myText->baselineOffset();
+ myText->setHeight(myText->height() + 42);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ QCOMPARE(baselineOffsetSpy.count(), 1);
+ QCOMPARE(myText->baselineOffset(), oldBaselineOffset + 42);
+ myText->setHeight(myText->height() - 42);
+ QVERIFY(QQuickTest::qWaitForItemPolished(myText));
+ QCOMPARE(baselineOffsetSpy.count(), 2);
+ QCOMPARE(myText->baselineOffset(), oldBaselineOffset);
}
void tst_qquicktext::fontSizeModeMultiline_data()
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 3309d4f672..66dde3e26c 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -191,12 +191,22 @@ class GrabMonitor : public QObject
{
public:
QObject *exclusiveGrabber = nullptr;
+ int transitionCount = 0;
bool fromMouseEvent = false;
bool canceled = false;
+ void reset()
+ {
+ exclusiveGrabber = nullptr;
+ transitionCount = 0;
+ fromMouseEvent = false;
+ canceled = false;
+ }
+
void onGrabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point)
{
qCDebug(lcTests) << grabber << transition << event << point << point.device();
+ ++transitionCount;
switch (transition) {
case QPointingDevice::GrabTransition::GrabExclusive:
exclusiveGrabber = grabber;
@@ -257,6 +267,8 @@ private slots:
void oneTouchInsideAndOneOutside();
+ void strayTouchDoesntAutograb();
+
protected:
bool eventFilter(QObject *, QEvent *event) override
{
@@ -1625,6 +1637,47 @@ void tst_TouchMouse::oneTouchInsideAndOneOutside() // QTBUG-102996
QQuickTouchUtils::flush(&window);
}
+void tst_TouchMouse::strayTouchDoesntAutograb() // QTBUG-107867
+{
+ QQuickView window;
+ QVERIFY(QQuickTest::showView(window, testFileUrl("singleitem.qml")));
+ QQuickItem *root = window.rootObject();
+ QVERIFY(root);
+ EventItem *eventItem = root->findChild<EventItem*>();
+ QVERIFY(eventItem);
+ // This item accepts (synth-)mouse events but NOT touch
+ eventItem->acceptMouse = true;
+ QCOMPARE(eventItem->acceptTouchEvents(), false); // the default in Qt 6
+ QPoint p1(6, 6);
+ grabMonitor.reset();
+
+ // Begin a new touch, that gets converted to a mouse press
+ QTest::touchEvent(&window, device).press(0, p1);
+ QQuickTouchUtils::flush(&window);
+ qCDebug(lcTests) << "after touch press:" << eventItem->eventList;
+ QCOMPARE(eventItem->eventList.size(), 1);
+ QCOMPARE(eventItem->eventList.at(0).type, QEvent::MouseButtonPress);
+ QCOMPARE(grabMonitor.exclusiveGrabber, eventItem);
+
+ // Drag
+ for (int i = 0; i < 3; ++i) {
+ QTest::touchEvent(&window, device).move(0, p1 + QPoint(i * 5, i * 5), &window);
+ QQuickTouchUtils::flush(&window);
+ QCOMPARE(grabMonitor.transitionCount, 1); // no new grab
+ QCOMPARE(eventItem->eventList.size(), i + 2);
+ QCOMPARE(eventItem->eventList.last().type, QEvent::MouseMove);
+ }
+
+ // Press an extra point: EventItem should see nothing
+ QTest::touchEvent(&window, device).stationary(0).press(1, p1);
+ QQuickTouchUtils::flush(&window);
+ qCDebug(lcTests) << "after press of second touchpoint:" << eventItem->eventList;
+ QCOMPARE(eventItem->eventList.size(), 4);
+ QCOMPARE(grabMonitor.transitionCount, 1); // no new grab
+
+ QTest::touchEvent(&window, device).release(0, p1).release(1, p1);
+}
+
QTEST_MAIN(tst_TouchMouse)
#include "tst_touchmouse.moc"
diff --git a/tests/auto/quickcontrols2/controls/data/tst_popup.qml b/tests/auto/quickcontrols2/controls/data/tst_popup.qml
index 863a5b558f..acb550fdd4 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_popup.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_popup.qml
@@ -1401,6 +1401,16 @@ TestCase {
property alias popup: popup
property alias popupTitle: popupTitle
+ property alias popupContent: popupContent
+ property bool gotMouseEvent: false
+
+ MouseArea {
+ id: windowMouseArea
+ enabled: true
+ anchors.fill: parent
+ onPressed: gotMouseEvent = true
+ }
+
Popup {
id: popup
@@ -1408,6 +1418,7 @@ TestCase {
height: 200
background: Rectangle {
+ id: popupContent
color: "#505050"
Rectangle {
id: popupTitle
@@ -1452,6 +1463,11 @@ TestCase {
let popup = window.popup
popup.open()
+
+ // mouse clicks into the popup must not propagate to the parent
+ mouseClick(window)
+ compare(window.gotMouseEvent, false)
+
let title = window.popupTitle
verify(title)
@@ -1465,5 +1481,6 @@ TestCase {
fuzzyCompare(popup.y, oldPos.y + 5, 1)
mouseRelease(title, pressPoint.x, pressPoint.y)
compare(title.pressedPosition, Qt.point(0, 0))
+
}
}
diff --git a/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml b/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml
index 0ad5eaffe9..6704d5894c 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml
@@ -628,4 +628,41 @@ TestCase {
verify(verticalScrollBar.active)
verify(horizontalScrollBar.active)
}
+
+ Component {
+ id: contentItemAssignedImperatively
+
+ Item {
+ width: 100
+ height: 100
+
+ property alias scrollView: scrollView
+
+ ListView {
+ id: listView
+ model: 20
+ delegate: Text {
+ text: modelData
+ }
+ }
+
+ Component.onCompleted: scrollView.contentItem = listView
+
+ ScrollView {
+ id: scrollView
+ anchors.fill: parent
+
+ ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+ }
+ }
+ }
+
+ // Tests that a ListView declared before the ScrollView (as the QObject destruction order
+ // is relevant for the bug) and assigned imperatively to ScrollView does not cause a crash
+ // on exit.
+ function test_contentItemAssignedImperatively() {
+ let root = createTemporaryObject(contentItemAssignedImperatively, testCase)
+ verify(root)
+ // Shouldn't crash.
+ }
}
diff --git a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml
index e1b8fcb79c..c925e68a36 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml
@@ -1591,4 +1591,26 @@ TestCase {
tryCompare(control, "busy", true)
tryCompare(control, "busy", false)
}
+
+ Component {
+ id: noProperties
+ Item {}
+ }
+
+ Component {
+ id: invalidProperties
+
+ StackView {
+ anchors.fill: parent
+ }
+ }
+
+ function test_invalidProperties() {
+ let control = createTemporaryObject(invalidProperties, testCase)
+ verify(control)
+ verify(control.empty)
+ ignoreWarning(/Cannot resolve property "unknownProperty.test"/)
+ control.push(noProperties, { "unknownProperty.test": "crashes" })
+ verify(!control.empty)
+ }
}
diff --git a/tests/auto/quickcontrols2/controls/data/tst_tooltip.qml b/tests/auto/quickcontrols2/controls/data/tst_tooltip.qml
index b4e992a46a..89e179575f 100644
--- a/tests/auto/quickcontrols2/controls/data/tst_tooltip.qml
+++ b/tests/auto/quickcontrols2/controls/data/tst_tooltip.qml
@@ -296,7 +296,13 @@ TestCase {
function test_activateShortcutWhileToolTipVisible() {
if ((Qt.platform.pluginName === "offscreen")
|| (Qt.platform.pluginName === "minimal"))
- skip("Mouse hoovering not functional on offscreen/minimal platforms")
+ skip("Mouse hovering not functional on offscreen/minimal platforms")
+
+ // Window shortcuts (the default context for Shortcut) require the window to have focus.
+ var window = testCase.Window.window
+ verify(window)
+ window.requestActivate()
+ tryCompare(window, "active", true)
var root = createTemporaryObject(buttonAndShortcutComponent, testCase)
verify(root)
@@ -456,4 +462,48 @@ TestCase {
control.show("Test")
tryCompare(openedSpy, "count", 1)
}
+
+ Component {
+ id: buttonDownToolTipComponent
+
+ Button {
+ required property string toolTipText
+
+ ToolTip.text: toolTipText
+ ToolTip.visible: down
+ }
+ }
+
+ function test_attachedSizeBug() {
+ let shortTextButton = createTemporaryObject(buttonDownToolTipComponent, testCase,
+ { toolTipText: "Short text" })
+ verify(shortTextButton)
+
+ let longTextButton = createTemporaryObject(buttonDownToolTipComponent, testCase,
+ { x: shortTextButton.width, toolTipText: "Some reeeeeeaaaaaaallly looooooooooongggggggg text" })
+ verify(longTextButton)
+
+ shortTextButton.ToolTip.toolTip.background.objectName = "ToolTipBackground"
+ shortTextButton.ToolTip.toolTip.contentItem.objectName = "ToolTipText"
+
+ // Show the tooltip with long text.
+ mousePress(longTextButton)
+ tryCompare(longTextButton.ToolTip.toolTip, "opened", true)
+ const longTextToolTipImplicitWidth = longTextButton.ToolTip.toolTip.implicitWidth
+ mouseRelease(longTextButton)
+ tryCompare(longTextButton.ToolTip.toolTip, "visible", false)
+
+ // Show the tooltip with short text.
+ mousePress(shortTextButton)
+ tryCompare(shortTextButton.ToolTip.toolTip, "opened", true)
+ mouseRelease(shortTextButton)
+ tryCompare(shortTextButton.ToolTip.toolTip, "visible", false)
+
+ // Show the tooltip with long text again. It should have its original width.
+ mousePress(longTextButton)
+ tryCompare(longTextButton.ToolTip.toolTip, "opened", true)
+ compare(longTextButton.ToolTip.toolTip.implicitWidth, longTextToolTipImplicitWidth)
+ mouseRelease(longTextButton)
+ tryCompare(longTextButton.ToolTip.toolTip, "visible", false)
+ }
}
diff --git a/tests/auto/quickcontrols2/controls/imagine/BLACKLIST b/tests/auto/quickcontrols2/controls/imagine/BLACKLIST
index bdb2af0b46..72eebcd21d 100644
--- a/tests/auto/quickcontrols2/controls/imagine/BLACKLIST
+++ b/tests/auto/quickcontrols2/controls/imagine/BLACKLIST
@@ -8,3 +8,7 @@
[RangeSlider::test_overlappingHandles]
b2qt
qnx
+
+# QTBUG-101704
+[ToolTip::test_attachedSizeBug]
+*
diff --git a/tests/auto/quickcontrols2/qquickimaginestyle/data/tst_imagine.qml b/tests/auto/quickcontrols2/qquickimaginestyle/data/tst_imagine.qml
index aaa4f9701d..c7afe4fbbf 100644
--- a/tests/auto/quickcontrols2/qquickimaginestyle/data/tst_imagine.qml
+++ b/tests/auto/quickcontrols2/qquickimaginestyle/data/tst_imagine.qml
@@ -188,9 +188,9 @@ TestCase {
{ target: testCase.Window.window, signalName: "afterRendering" })
verify(afterRenderingSpy.valid)
- afterRenderingSpy.wait(100)
+ afterRenderingSpy.wait(1000)
container.ninePatchImage.source = ""
// Shouldn't result in a crash.
- afterRenderingSpy.wait(100)
+ afterRenderingSpy.wait(1000)
}
}
diff --git a/tests/auto/quickcontrols2/qquickmenu/data/actionShortcuts.qml b/tests/auto/quickcontrols2/qquickmenu/data/actionShortcuts.qml
new file mode 100644
index 0000000000..87ad41c8c5
--- /dev/null
+++ b/tests/auto/quickcontrols2/qquickmenu/data/actionShortcuts.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+import QtQuick.Controls
+
+ApplicationWindow {
+ width: 400
+ height: 400
+
+ property alias menu: menu
+ property alias subMenu: subMenu
+ property alias buttonMenu: buttonMenu
+
+ Menu {
+ id: menu
+ objectName: "menu"
+
+ Action {
+ objectName: text
+ text: "action1"
+ shortcut: "A"
+ }
+
+ Menu {
+ id: subMenu
+ objectName: "subMenu"
+
+ Action {
+ objectName: text
+ text: "subAction1"
+ shortcut: "B"
+ }
+ }
+ }
+
+ Button {
+ text: "Menu button"
+
+ Menu {
+ id: buttonMenu
+
+ Action {
+ objectName: text
+ text: "buttonMenuAction1"
+ shortcut: "C"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp b/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp
index 4774a9060f..9e37541137 100644
--- a/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp
+++ b/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp
@@ -37,6 +37,9 @@
#include <QtTest/qtest.h>
#include <QtTest/qsignalspy.h>
#include <QtGui/qcursor.h>
+#if QT_CONFIG(shortcut)
+#include <QtGui/qkeysequence.h>
+#endif
#include <QtGui/qstylehints.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -83,6 +86,9 @@ private slots:
void order();
void popup();
void actions();
+#if QT_CONFIG(shortcut)
+ void actionShortcuts();
+#endif
void removeTakeItem();
void subMenuMouse_data();
void subMenuMouse();
@@ -1047,6 +1053,56 @@ void tst_QQuickMenu::actions()
QVERIFY(menuItem1.isNull());
}
+#if QT_CONFIG(shortcut)
+void tst_QQuickMenu::actionShortcuts()
+{
+ QQuickControlsApplicationHelper helper(this, QLatin1String("actionShortcuts.qml"));
+ QVERIFY2(helper.ready, helper.failureMessage());
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ // Try the menu's shortcut.
+ QQuickMenu *menu = window->property("menu").value<QQuickMenu *>();
+ QVERIFY(menu);
+ QPointer<QQuickAction> action1 = menu->actionAt(0);
+ QVERIFY(action1);
+ QCOMPARE(action1->shortcut(), QKeySequence(Qt::Key_A));
+
+ QSignalSpy action1TriggeredSpy(action1, SIGNAL(triggered()));
+ QVERIFY(action1TriggeredSpy.isValid());
+
+ QTest::keyClick(window, Qt::Key_A);
+ QCOMPARE(action1TriggeredSpy.count(), 1);
+
+ // Try the sub-menu.
+ QQuickMenu *subMenu = window->property("subMenu").value<QQuickMenu *>();
+ QVERIFY(subMenu);
+ QPointer<QQuickAction> subMenuAction1 = subMenu->actionAt(0);
+ QVERIFY(subMenuAction1);
+ QCOMPARE(subMenuAction1->shortcut(), QKeySequence(Qt::Key_B));
+
+ QSignalSpy subMenuAction1TriggeredSpy(subMenuAction1, SIGNAL(triggered()));
+ QVERIFY(subMenuAction1TriggeredSpy.isValid());
+
+ QTest::keyClick(window, Qt::Key_B);
+ QCOMPARE(subMenuAction1TriggeredSpy.count(), 1);
+
+ // Try the button menu.
+ QQuickMenu *buttonMenu = window->property("buttonMenu").value<QQuickMenu *>();
+ QVERIFY(buttonMenu);
+ QPointer<QQuickAction> buttonMenuAction1 = buttonMenu->actionAt(0);
+ QVERIFY(buttonMenuAction1);
+ QCOMPARE(buttonMenuAction1->shortcut(), QKeySequence(Qt::Key_C));
+
+ QSignalSpy buttonMenuAction1TriggeredSpy(buttonMenuAction1, SIGNAL(triggered()));
+ QVERIFY(buttonMenuAction1TriggeredSpy.isValid());
+
+ QTest::keyClick(window, Qt::Key_C);
+ QCOMPARE(buttonMenuAction1TriggeredSpy.count(), 1);
+}
+#endif
+
void tst_QQuickMenu::removeTakeItem()
{
QQuickControlsApplicationHelper helper(this, QLatin1String("removeTakeItem.qml"));
diff --git a/tests/auto/quickcontrols2/qquickpopup/data/applicationwindow-wheel.qml b/tests/auto/quickcontrols2/qquickpopup/data/applicationwindow-wheel.qml
index 8d3f7f9592..163cf77996 100644
--- a/tests/auto/quickcontrols2/qquickpopup/data/applicationwindow-wheel.qml
+++ b/tests/auto/quickcontrols2/qquickpopup/data/applicationwindow-wheel.qml
@@ -58,6 +58,7 @@ ApplicationWindow {
height: 400
property alias popup: popup
+ property alias nestedPopup: nestedPopup
property alias popupSlider: popupSlider
property alias contentSlider: contentSlider
@@ -77,5 +78,13 @@ ApplicationWindow {
id: popupSlider
wheelEnabled: true
}
+
+ Popup {
+ id: nestedPopup
+ x: 0; y: 0
+ clip: true
+ implicitWidth: 50
+ implicitHeight: 50
+ }
}
}
diff --git a/tests/auto/quickcontrols2/qquickpopup/data/window-wheel.qml b/tests/auto/quickcontrols2/qquickpopup/data/window-wheel.qml
index e476a1ebc0..8eb5260cf3 100644
--- a/tests/auto/quickcontrols2/qquickpopup/data/window-wheel.qml
+++ b/tests/auto/quickcontrols2/qquickpopup/data/window-wheel.qml
@@ -58,6 +58,7 @@ Window {
height: 400
property alias popup: popup
+ property alias nestedPopup: nestedPopup
property alias popupSlider: popupSlider
property alias contentSlider: contentSlider
@@ -77,5 +78,13 @@ Window {
id: popupSlider
wheelEnabled: true
}
+
+ Popup {
+ id: nestedPopup
+ x: 0; y: 0
+ clip: true
+ implicitWidth: 50
+ implicitHeight: 50
+ }
}
}
diff --git a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp
index e758d04276..75d66335f1 100644
--- a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp
@@ -998,6 +998,10 @@ void tst_QQuickPopup::wheel()
QVERIFY(popup && popup->contentItem());
popup->setModal(modal);
+ QQuickPopup *nestedPopup = window->property("nestedPopup").value<QQuickPopup*>();
+ QVERIFY(nestedPopup && nestedPopup->contentItem());
+ nestedPopup->setModal(modal);
+
QQuickSlider *popupSlider = window->property("popupSlider").value<QQuickSlider*>();
QVERIFY(popupSlider);
@@ -1028,6 +1032,22 @@ void tst_QQuickPopup::wheel()
QVERIFY(!qFuzzyCompare(popupSlider->value(), oldPopupValue)); // must have moved
}
+ QSignalSpy nestedOpenedSpy(nestedPopup, SIGNAL(opened()));
+ QVERIFY(nestedOpenedSpy.isValid());
+ nestedPopup->open();
+ QVERIFY(nestedOpenedSpy.size() == 1 || nestedOpenedSpy.wait());
+
+ {
+ // wheel over the popup content
+ qreal oldContentValue = contentSlider->value();
+ qreal oldPopupValue = popupSlider->value();
+
+ QVERIFY(sendWheelEvent(popupSlider, QPoint(popupSlider->width() / 2, popupSlider->height() / 2), 15));
+
+ QVERIFY(qFuzzyCompare(contentSlider->value(), oldContentValue)); // must not have moved
+ QCOMPARE(qFuzzyCompare(popupSlider->value(), oldPopupValue), modal); // must not have moved unless modeless
+ }
+
{
// wheel over the overlay
qreal oldContentValue = contentSlider->value();
diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/BLACKLIST b/tests/auto/quickdialogs/qquickfiledialogimpl/BLACKLIST
index 822b92dd19..7601025475 100644
--- a/tests/auto/quickdialogs/qquickfiledialogimpl/BLACKLIST
+++ b/tests/auto/quickdialogs/qquickfiledialogimpl/BLACKLIST
@@ -5,3 +5,7 @@
# QTBUG-92585
[fileMode:OpenFiles]
*
+
+# QTBUG-101488
+[goUpIntoLargeFolder]
+*
diff --git a/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml b/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml
new file mode 100644
index 0000000000..92598eb490
--- /dev/null
+++ b/tests/baseline/scenegraph/data/text/text_nativerendering_no_antialiasing.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+//vary font style, native rendering without antialiasing
+
+Item {
+ id: topLevel
+ width: 320
+ height: 580
+
+ Repeater {
+ model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken]
+ Text {
+ y: 20 * index
+ clip: true
+ renderType: Text.NativeRendering
+ width: parent.width
+ wrapMode: Text.Wrap
+ font.pointSize: 10
+ style: modelData
+ styleColor: "green"
+ antialiasing: false
+ text: "The quick fox jumps in style " + modelData
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qqmlchangeset/CMakeLists.txt b/tests/benchmarks/qml/qqmlchangeset/CMakeLists.txt
index 2d6461eefd..ee61a372af 100644
--- a/tests/benchmarks/qml/qqmlchangeset/CMakeLists.txt
+++ b/tests/benchmarks/qml/qqmlchangeset/CMakeLists.txt
@@ -1,10 +1,10 @@
# Generated from qqmlchangeset.pro.
#####################################################################
-## tst_qqmlchangeset Binary:
+## tst_bench_qqmlchangeset Binary:
#####################################################################
-qt_internal_add_benchmark(tst_qqmlchangeset
+qt_internal_add_benchmark(tst_bench_qqmlchangeset
SOURCES
tst_qqmlchangeset.cpp
DEFINES
diff --git a/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt b/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt
index 9e3a6d58c1..ad39b3ea0b 100644
--- a/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt
+++ b/tests/benchmarks/quickcontrols2/creationtime/CMakeLists.txt
@@ -1,5 +1,11 @@
# Generated from creationtime.pro.
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_creationtime LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
+endif()
+
#####################################################################
## tst_creationtime Test:
#####################################################################
diff --git a/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt b/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt
index 752230ec7e..e0434a08eb 100644
--- a/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt
+++ b/tests/benchmarks/quickcontrols2/objectcount/CMakeLists.txt
@@ -1,5 +1,11 @@
# Generated from objectcount.pro.
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_objectcount LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
+endif()
+
#####################################################################
## tst_objectcount Test:
#####################################################################
diff --git a/tests/manual/pointer/pinchNullTarget.qml b/tests/manual/pointer/pinchNullTarget.qml
new file mode 100644
index 0000000000..79c6047991
--- /dev/null
+++ b/tests/manual/pointer/pinchNullTarget.qml
@@ -0,0 +1,50 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick 2.15
+
+Rectangle {
+ width: 1024; height: 600
+ color: "#eee"
+
+ function getTransformationDetails(item, pinchhandler) {
+ return "\n\npinch.scale:" + pinchhandler.scale.toFixed(2)
+ + "\npinch.activeScale:" + pinchhandler.activeScale.toFixed(2)
+ + "\npinch.rotation:" + pinchhandler.rotation.toFixed(2)
+ + "\npinch.translation:" + "(" + pinchhandler.translation.x.toFixed(2) + "," + pinchhandler.translation.y.toFixed(2) + ")"
+ + "\nrect.scale: " + item.scale.toFixed(2)
+ + "\nrect.rotation: " + item.rotation.toFixed(2)
+ + "\nrect.position: " + "(" + item.x.toFixed(2) + "," + item.y.toFixed(2) + ")"
+ }
+
+ Rectangle {
+ width: parent.width - 100; height: parent.height - 100; x: 50; y: 50
+ color: "lightsteelblue"
+ antialiasing: true
+ scale: pinch.scale
+
+ PinchHandler {
+ id: pinch
+ target: null
+ minimumScale: 0.5
+ maximumScale: 3
+ }
+
+ Text {
+ text: "Pinch with 2 fingers to scale, rotate and translate"
+ + getTransformationDetails(parent, pinch)
+ }
+ }
+
+ Rectangle {
+ id: centroidIndicator
+ x: pinch.centroid.scenePosition.x - radius
+ y: pinch.centroid.scenePosition.y - radius
+ z: 1
+ visible: pinch.active
+ radius: width / 2
+ width: 10
+ height: width
+ color: "red"
+ }
+}
diff --git a/tests/manual/quickcontrols2/testbench/controls/Button.qml b/tests/manual/quickcontrols2/testbench/controls/Button.qml
index ac57453fed..43389520fb 100644
--- a/tests/manual/quickcontrols2/testbench/controls/Button.qml
+++ b/tests/manual/quickcontrols2/testbench/controls/Button.qml
@@ -56,25 +56,47 @@ QtObject {
[],
["disabled"],
["pressed"],
- ["checked"],
- ["checked", "disabled"],
- ["checked"],
+ ["checkable", "checked"],
+ ["checkable", "checked", "disabled"],
+ ["checkable", "checked"],
["highlighted"],
["highlighted", "disabled"],
["highlighted", "pressed"],
- ["highlighted", "checked"],
+ ["highlighted", "checkable"],
["highlighted", "checkable", "pressed"],
["highlighted", "checkable", "checked"],
+ ["icon"],
+ ["icon", "disabled"],
+ ["icon", "pressed"],
+ ["icon", "checkable", "checked"],
+ ["icon", "checkable", "checked", "disabled"],
+ ["icon", "checkable", "checked"],
+ ["icon", "highlighted"],
+ ["icon", "highlighted", "disabled"],
+ ["icon", "highlighted", "pressed"],
+ ["icon", "highlighted", "checkable"],
+ ["icon", "highlighted", "checkable", "pressed"],
+ ["icon", "highlighted", "checkable", "checked"],
["flat"],
["flat", "disabled"],
["flat", "pressed"],
- ["flat", "checked"],
["flat", "checkable"],
+ ["flat", "checkable", "checked"],
["flat", "checkable", "pressed"],
["flat", "checkable", "checked", "pressed"],
["flat", "checkable", "highlighted"],
["flat", "checkable", "highlighted", "pressed"],
- ["flat", "checkable", "highlighted", "checked"]
+ ["flat", "checkable", "highlighted", "checked"],
+ ["icon", "flat"],
+ ["icon", "flat", "disabled"],
+ ["icon", "flat", "pressed"],
+ ["icon", "flat", "checkable"],
+ ["icon", "flat", "checkable", "checked"],
+ ["icon", "flat", "checkable", "pressed"],
+ ["icon", "flat", "checkable", "checked", "pressed"],
+ ["icon", "flat", "checkable", "highlighted"],
+ ["icon", "flat", "checkable", "highlighted", "pressed"],
+ ["icon", "flat", "checkable", "highlighted", "checked"]
]
property Component component: Button {
@@ -86,5 +108,6 @@ QtObject {
// Only set it if it's pressed, or the non-pressed examples will have no press effects
down: is("pressed") ? true : undefined
highlighted: is("highlighted")
+ icon.source: is("icon") ? "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png" : ""
}
}