Commit Graph

9317 Commits

Author SHA1 Message Date
Shawn Rutledge a432970b25 Standardize Drag/PinchHandler active/persistent scale, rotation, translation
PinchHandler.scale is persistent between gestures, whereas rotation and
translation were active-gesture properties; that wasn't consistent.
We fixed up DragHandler in just this way in 6.2.

The translationChanged() signal now comes with a vector delta, which is
often useful when writing an onTranslationChanged JS handler. Likewise,
scaleChanged() and rotationChanged() come with qreal deltas. The
scaleChanged() delta is multiplicative rather than additive, because
an additive delta would not be useful in cases when some target item's
scale can be adjusted by alternative means: you need to multiply it
in your onScaleChanged function.

Now that PinchHandler has 4 axes as grouped properties, some properties
in the handlers themselves begin to look redundant; but at least the
translation properties are useful to group x and y together. So in this
patch we continue to follow the pattern that was set in
60d11e1f69. PinchHandler.scale is
equivalent to persistentScale, whereas rotation is equivalent to
activeRotation; so we have a reason to deprecate those properties, as in
ea63ee5233.

The persistent values have setters, to provide another way for
applications to compensate when the values are adjusted by other means,
as an alternative to incremental changes via a script such as
rotationAxis.onValueDelta, onRotationChanged etc.

[ChangeLog][QtQuick][Event Handlers] PinchHandler.activeTranslation now
holds the amount of movement since the pinch gesture began.
PinchHandler.persistentTranslation holds the accumulated sum of
movement that has occurred during subsequent pinch gestures, and can
be set to arbitrary values between gestures. Likewise, activeScale,
persistentScale, activeRotation and persistentRotation follow the
same pattern. The scaleChanged, rotationChanged, and translationChanged
signals include delta arguments, which are useful for incrementally
adjusting a non-default item property when the target is null.

Fixes: QTBUG-76739
Task-number: QTBUG-94168
Change-Id: I6aaa1aa3356b85e6d27abc64bfa67781ecb4f062
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-12-10 19:18:21 +01:00
Shawn Rutledge 7867a683fc Add PinchHandler.scaleAxis, rotationAxis; hold values in axes
Pointer Handlers that manipulate target item properties should now
use QQuickDragAxis consistently to:
- enforce minimum and maximum values
- hold the persistent and active values
- make those available via properties
- emit a new activeValueChanged(delta) signal when the value changes,
  so that it's possible to incrementally update a target item
  property in JS (onValueDelta: target.property += delta)

In the pinchHandler.qml example, you can use the PinchHandler to adjust
4 properties of one Rectangle independently (it requires coordination).

m_boundedActiveValue controls whether m_activeValue will be
kept between minimum and maximum. For rotation,
tst_QQuickPinchHandler::scaleNativeGesture() expects it to be,
although that seems questionable now, and may be addressed later.

[ChangeLog][QtQuick][Event Handlers] PinchHandler now has scaleAxis and
rotationAxis grouped properties, alongside the existing xAxis and yAxis;
and all of these now have activeValue and persistentValue properties.
The activeValueChanged signal includes a delta value, giving the
incremental change since the previous activeValue. The persistentValue
is settable, in case some target item property can be adjusted in
multiple ways: the handler's stored value can then be synced up with the
item property value after each external change. These features are
also added to DragHandler's xAxis and yAxis properties.

Task-number: QTBUG-68108
Task-number: QTBUG-76380
Task-number: QTBUG-76379
Task-number: QTBUG-94168
Change-Id: I78a5b43e9ba580448ef05054b6c4bc71b1834dd6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-12-10 03:13:57 +01:00
Shawn Rutledge f064497bd5 Blacklist tst_qquicktextedit::pasteHtmlIntoMarkdown on Ubuntu 20.04
Task-number: QTBUG-108346
Change-Id: I2345d37e12b2f4a3f3224a15f95bb6fabca56cd1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-10 03:13:57 +01:00
Ulf Hermann 59c9b5d1f7 Avoid memory leaks in tst_qquickloader.cpp
Change-Id: Id5cb654bd911fc42cf01606d376496d0c04d68f3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-12-09 23:22:25 +01:00
Ulf Hermann 303bfe42e8 qmllint: Read the right register when analyzing calls
CallProperty does not use the accumulator.

Pick-to: 6.4 6.4.2
Fixes: QTBUG-109144
Change-Id: I2bd98bb3a66d68806d250bd50226a8f8e0cdf765
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-12-09 23:22:09 +01:00
Ulf Hermann 4677b2bdd6 QML: Add an accurate stack bounds checker
This re-introduces a stack bounds checker. The previous stack bounds
checker was removed in commit 74f75a3a12
because the cost of determining the stack base was deemed too high.

Indeed, determining the stack base on linux using the pthread functions
costs about 200.000 instructions and the cost grows with the number of
concurrently running threads.

However, by reading /proc/self/maps directly we can trim this to about
125k instructions. Furthermore, with the new implementation we only need
to do this once per engine. Calling JavaScript functions of the same
engine from different threads is not supported. So we don't have to
consider the case of checking the bounds of a different thread than the
one the engine was created in. Furthermore, we get a more accurate
number now, which means we don't have to re-check when we get near the
boundary.

Also, change QV4::markChildQObjectsRecursively() to use an actual
QQueue instead of being recursive. This avoids the stack from overflowing when the stack is already almost full, and was leading to
crashes in the stackOverflow tests.

Make the stack smaller for the the tst_qquickloader::stackOverflow{,2} tests to run faster in the CI (and avoid the timeout).

Task-number: QTBUG-106875
Fixes: QTBUG-108182
Change-Id: Ia5d13caa7d072526ff2a3e1713ec7781afc154a9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-09 20:04:56 +01:00
Richard Moe Gustavsen 8333954f7e QQQuickTreeView: double expand from TreeView, not TreeViewDelegate
We should ideally implement as much mouse logic as
possible outside the delegate. This will make it
easier to implement custom delegates, since you would
then only have to care about the visuals, and not the
mouse logic.

Therefore, move the doubleTap-to-toggle-expanded
logic out of TreeViewDelegate, and into TreeView, for
all custom delegates to enjoy.

Change-Id: I01f49252d35fed033f162d7bab47478abefe73d1
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-09 11:38:54 +01:00
Liang Qi f756c201c5 Merge "Merge remote-tracking branch 'origin/wip/material3' into dev" 2022-12-09 02:19:50 +01:00
Richard Moe Gustavsen 21bf976a41 QQuickTreeViewDelegate: implement edit delegates
This patch will implement a default edit delegate
for the TreeViewDelegates, for all our styles.

[ChangeLog][Controls] TreeViewDelegate got support
for editing nodes in the tree.

Change-Id: Iec5936e4439770586837daa3b8045482b75a15f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-08 23:33:42 +01:00
Richard Moe Gustavsen 52cbcd947d QQuickTableView: support multi-selection
Implement support for doing multiple selections in
TableView by holding down the shift modifier while
dragging.

[ChangeLog][Quick][TableView] Added multi-selection support
if using a SelectionRectangle and holding down the shift-modifier.

Change-Id: Ife622aeea2ed60a5741df01f3aac2fb647108aa9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-12-08 23:25:20 +01:00
Fabian Kosmale e43638c8a8 QQmlEngine: Add module + type based singletonInstance overload
This makes it consistent with QQmlComponent::loadFromModule. It also
avoids the issue the qmlTypeId does currently only work if the module
has been imported; though that will be fixed in a separate commit.

Change-Id: Id284f7ed2de7af461b782c5b5d71d9bfc0039844
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-12-08 15:48:34 +01:00
Liang Qi 871fe574cf Merge remote-tracking branch 'origin/wip/material3' into dev
Change-Id: Iebc21fd341884dc9fbcf394a29c856727129db6d
2022-12-08 09:22:22 +01:00
Jan Arve Sæther 373b6e54dd Add {horizontal,vertical}StretchFactor
This utilizes the standard implementation of stretch factors that is
already in the QGridLayoutEngine

[ChangeLog][QtQuick][Layouts] Added support for stretch factors

Fixes: QTBUG-32923
Change-Id: I4afa7636dda465af2230c2919daa5c40831c44ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-12-08 01:01:11 +01:00
Ulf Hermann ce005eae58 QML: Unify postprocessing of imports
We want to always import dependencies, always import qualified scripts,
and always try to load C++-based types from the binary. Furthermore,
directory imports should be imported with their qmldir URI where
possible, so that we can find them when loading local C++-based types.

Fixes: QTBUG-109109
Change-Id: I58f08f479623a886c802035b41f5f604338468b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-07 16:48:35 +01:00
Edward Welbourne 7d1579a5a2 Impose alphabetic order on long lists of core includes
It was getting hard to keep track of what's there and where to add the
ones I need to add.

Change-Id: I849af9fae993202808b49622d3315b47aa283902
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-07 13:50:01 +01:00
Edward Welbourne 523a85eeaa Fix two "could be override" warnings in tst_qqmlcomponent.cpp
Change-Id: I05f991d27f6895805306ed610f0936965e7854e1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-07 13:50:01 +01:00
Sami Shalayel ee9e3a10d9 qmltc: fix handlers for c++-signals
Allow qmltc to generate handlers for c++-defined signals with const
parameters by changing the safeguard to avoid type mismatch between
slots and signals.

First, remove the qOverload in the generated QObject::connect call to
be able the connect slots and signals with different types (namely,
pass by const references and pass by value should be interchangeable but
is not allowed by qOverload).

Second, save in QQmlJSMetaParameter when types are passed by pointer.
Like this, qqmljsimportvisitor can check if a value type is indeed
passed by value or const reference in a C++ signal. The same for reference
types that need to be passed by (const and non-const) pointer.
Print a message when an type is passed by argument in an incompatible
way instead of letting qmltc generate uncompilable code, which makes the
compiler print out cryptical messages.

Third, add a qqmlcpptypehelpers template that decides if value types
should be passed by value or reference, by letting the c++ compiler
check if sizeof(T) > 3*sizeof(void*).

Fixes: QTBUG-107625
Fixes: QTBUG-107622
Change-Id: I1a00532df591d10f74c1fd00dff5b7fccf40cb22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-07 13:50:01 +01:00
Ulf Hermann a354d91b88 QmlCompiler: Ignore cloned signals when analyzing signal handlers
We obviously want to see the defaulted parameters when generating the
handlers.

Fixes: QTBUG-108762
Change-Id: I33a52bac305238467d45650bf8a2ad59d40e366f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-07 13:50:01 +01:00
David Edmundson 139bae68b6 Expose QMatrix mapping functions to JS space
When using a matrix in JS code, being able to map points and rectangles
through it is a reasnoble task. We have everything available in the C++
side just not exposed.

Change-Id: I64cc3f0b5fef8eeabc618dad24de19321a96b2fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-07 10:20:04 +00:00
Richard Moe Gustavsen 84d3c382f8 QQuickTableView: let the edit delegate be a child of the cell delegate
The first version parented the edit delegate to the content
item of QQuickTableView. This approach, however, turned out
make it really difficult to implement an edit delegate that
relied on the geometry of items inside the tableview delegate.

E.g for a TreeViewDelegate, we would like to show an editable
TextField on top of the label while editing. But only on top
of the label, not the whole delegate (including
e.g the expanded/collapsed indicator). Moreover, we don't want
to hide the whole delegate while editing, only the label that
is underneatch (a possible semi-transparent) edit delegate.

For this to be possible, we therefore need to parent the edit
delegate to the TableView delegate instead, so that the edit
delegate can e.g more easily query the geometry of the items
inside the delegate (like the label) to position its own items
(like a TextField).

Since we also want the developer to then have more control
over which items get hidden, we offer a property:
"required property bool editing" to the tableview delegate.
This can be used to e.g hide items inside the delegate while its
being edited (or to implement other kinds of transitions).

This new solution should also be easier to work with, and
understand, for application developers, since the parent-child
structure now mirrors the location where the edit delegate is
written in QML.

Change-Id: Ieeae28c8297f8bb1fb2d90d152fd575b4f41f36f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-12-07 01:17:19 +01:00
Fabian Kosmale 0f2a7b1932 QQmlJSImportVisitor: Do not deref potentially null type
When checking for default properties, a type may not be resolved (due to
a missing import). So check for that first before checking that the type
is a list property.

Fixes: QTBUG-109197
Change-Id: Idc142588b5d8bc52fdea52d637afc3643e7d9891
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-05 20:46:21 +01:00
Semih Yavuz 9793c663cc Fix comparison AOT-lookup and intended type in value types
We currently force the lookup metatype to be exactly the same data type
with the caller's. As a result, the conversion from enum to integral
data type is not recognized. Relax this comparison by using
isTypeCompatible helper.

Pick-to: 6.4
Fixes: QTBUG-109007
Change-Id: I188dc3e6c1fd7100e9ed5c4ba5d0c90d85d79be4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-05 17:39:24 +01:00
Ulf Hermann 23d5540ee4 qmltyperegistrar: Propagate the "isCloned" flag through qmltypes
Task-number: QTBUG-108762
Change-Id: I916ec32329bccfff89a93a57aaca183e3f798197
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-05 13:35:48 +01:00
Volker Hilsheimer a8efd5dda8 QQmlPropertyMap: Verify that inserting duplicate keys behaves
Even if those keys are empty, they do not result in duplicate entries.
Empty keys are allowed, even if that doesn't make sense in practice.

Fixes: QTBUG-109029
Change-Id: I8c6bc6599318c99c1afd0a9edd7b29cd32759f06
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-12-05 13:35:48 +01:00
Richard Moe Gustavsen b12c7ca751 QQuickTableView: add layoutChanged() signal
Add a new signal to TableView that tells when the
layout has changed. This signal can be used to
reposition any overlay on the content item, including
e.g SelectionHandles.

[ChangeLog][Quick][TableView] Added new signal 'layoutChanged()'

Change-Id: I5b89a064521c2831279accbc889deb768d9b1a1b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-12-05 10:27:51 +01:00
Paul Wicking 5ce3b931fe Merge remote-tracking branch 'origin/dev' into wip/material3
Change-Id: I55ec34220c5b9001893fc924ab6be7fd64e63a02
2022-12-05 09:21:58 +01:00
Mitch Curtis e592a2ad31 Warn users when they customize native styles
Since Qt 6, the default style is no longer the Basic style, but instead
depends on the platform the application is run on. In addition, the
introduction of the native styles (which are not designed to be
customized) means that users customizing controls can run into visual
issues and not understand why.

This patch partially addresses this issue by warning when a native
control is customized (i.e. a delegate is overridden):

"qrc:/main.qml:11:22: QML QQuickItem: The current style does not
support customization of this control (property: "contentItem" item:
QQuickItem(0x1637375d210, parent=0x0, geometry=0,0 0x0)).
Please customize a non-native style (such as Basic, Fusion, Material,
etc). For more information, see:
https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference"

Ideally we'd also have qmllint integration in Creator so that users get
warnings from the IDE as they code, but that's not there yet.

The patch also updates the documentation by removing the code snippet
from the note and referring users to the existing
"Using Styles in Qt Quick Controls" section, which covers the topic in
greater detail. The snippet itself is also not considered a part of the
note, so the (online) styling looked a bit off.

[ChangeLog][Important Behavior Changes] Customization of native styles
will now result in warnings. Non-native styles (such as Basic) should
be used for customization purposes, or a custom style. If you are aware
of the risks and still want to customize these controls, you can ignore
the warnings by setting QT_QUICK_CONTROLS_IGNORE_CUSTOMIZATION_WARNINGS
to 1.

Fixes: QTBUG-108519
Task-number: QTBUG-96733
Change-Id: Ib6dff4639bad76b228e0f31285d20db4e3207224
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-12-05 15:00:35 +08:00
Ulf Hermann 0b508c9617 Fix a few CMake warnings
Use AUTO_RESOURCE_PREFIX and move QML modules into suitable output
directories.

Change-Id: If39218450cf8dda41547c45a9b5deaa8673915bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-02 19:53:12 +01:00
Sami Shalayel cda417cf03 qv4qobjectwrapper: return false on failed argument conversion
It was possible to call c++-methods (either invokable or as slot) with
wrong arguments, which caused a crash.
The reason was that CallMethod(...) converted something to a QObject
without checking if it was an actual QObject. The wrongly typed argument
would end up reinterpret_cast'ed into another type for the call, which
leads to segmentation fault when accessing the argument in the function.

Added a test where an int tried to be reinterpret-cast'ed into a QFont.

Pick-to: 6.4 6.2
Fixes: QTBUG-108994
Change-Id: I8c45c9124411ad3fd100faed0b03390843f7d034
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-02 18:53:12 +00:00
Fabian Kosmale 3f4856dbca Introduce QQmlApplicationEngine::loadFromModule
This allow instantiating QML types via their module and typename. It
simply exposes the underlying functionality of
QQmlComponent::loadFromModule.
Also add the corresponding convenience constructor.

This commit also does some minor refactoring so that functionality can
be shared between load and loadFromModule.

[ChangeLog][QtQml][QQmlApplicationEngine] It is now possible to load QML
types via their module and type name.

Fixes: QTBUG-97156
Change-Id: Iee812db269d27e4db4b10117ed2570272a7cc40c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-02 16:55:21 +01:00
Alexandru Croitor 2e4fad5f1d CMake: Add iOS build auto test for Qt Quick project
Currently we can't run iOS tests in the CI, but we can at least build
them.

Reuse the CMake deployment auto test as a regular build test
(no deployment) when targeting iOS.

This ensures we don't regress in building iOS projects that use qml
modules.

Move the deployment test to be added earlier in the CMakeLists.txt
file and return early when both IOS and QT_BUILD_MINIMAL_STATIC_TESTS
are true, so that we build only that test in the CI for iOS.

Pick-to: 6.4
Fixes: QTBUG-96056
Change-Id: I68002c5b70bb3f182cf55ec4a2d4888ea9e2b81e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-02 13:58:55 +01:00
Ulf Hermann 8bc748e7e5 QmlCompiler: Fix various kinds of enum lookup
* If we got an object type exposed as namespace, we still need to add
  the "*" to get its augmentedInternalName(). Otherwise we cannot get
  its metaobject, needed to look up enums.
* Enums cannot be shadowed. The shadow check will produce garbage if we
  try to check because an enum lookup also does not use the accumulator,
  which then contains some artifact from a previous operation.
* If we find a property lookup on a plain QMetaObject* we have to
  immediately return in order to not confuse it with attached
  properties.

Pick-to: 6.4 6.2
Fixes: QTBUG-109048
Change-Id: If9e3b4806e4d773de9cf48f1b3750b684a8c8f69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-02 13:35:42 +01:00
Ulf Hermann f0528befa0 QQmlMetaObjectWrapper: A metaobject is not equal to a non-metaobject
In particular, the Qt object's prototype is not equal to anything.

Change-Id: I208d0bd914b0890e842775d273f2d3b5c63c1d36
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-02 13:35:31 +01:00
Sami Shalayel 591306fb07 qmltc: error out when encoutering invalid filenames
Dashes and other special characters in qml filenames makes
life quite complicated, the generated cpp file will contain
everywhere and be uncompilable.
Instead, directly print an error message explaoining which names
are allowed for type compilation and return.

Reasoning:
The name of the qml file is also the name of the qml object.
For example, using a dash in the filename makes the corresponding
qml type have a dash in its name and renders the type mostly
unsuable in qml.
Therefore, only allow characters, digits and underscores.

Pick-to: 6.4
Fixes: QTBUG-107079
Change-Id: I4bff12e4a644b479213e7cc578207c8a443fc517
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-12-02 10:39:44 +01:00
Richard Moe Gustavsen ed83f0f795 QQuickTableView: implement TableView.editDelegate
This patch will implement support for editing cells
in TableView. It enables you to attach an edit delegate
to the tableview delegate, using the attached property
TableView.editDelegate.

The application can initiate editing by calling TableView.edit()
(and TableView.closeEditor()) explicitly, or implicitly by using
edit triggers. The EditTriggers enum in TableView mirrors the
EditTriggers in QTableView (Widgets).

[ChangeLog][Quick][TableView] Added support for editing cells

Fixes: QTBUG-108838
Change-Id: I25df93a7eeabf9d8a4c4c6248e020d8eba6d5bd7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-12-01 12:01:46 +01:00
Volker Hilsheimer d1b9a4cacf QQuickItem: Fix effective visibility for items without parent
Items are visible if they are children of a visible parent, and not
explicitly hidden. The effectiveVisible member stores the state and is
updated when conditions that impact the item visibility changes.

The old code returned true for items outside a visual hierarchy, which
broke signal emission when items were removed from a parent, e.g.
because the parent got destroyed. With this change, items removed from
a visual hierarchy will emit the visibleChanged signal.

Note: QQuickItem initializes the effectiveVisible member to true, even
if the item was created without parent item. Visual items are required
to be added to a visual hierarchy via setParentItem. For this reason,
newly created items never emit visibleChanged when they are added to
a parent.

Adjust the QQuickItem::visible test - it creates an item hierarchy
without window. Such items are never visible, so add a window and
parent the test item hierarchy to the window's content item.

This fixes the expected failures in the tests. It does introduce an
incompatibility with QGraphicsView and QGraphicsItem, which continue
to return true from QGraphicsItem::isVisible for items that are not
in an item hierarchy.

[ChangeLog][Qt Quick][QQuickItem] The visible property of Items without
a parent now always returns false, and the visibleChanged signal gets
emitted when the parent item of a visible item becomes null.

Fixes: QTBUG-108213
Change-Id: If4b2947cefd1407853f0f29e6c3fdbd49fc9af65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-01 06:26:40 +01:00
Mitch Curtis 4bd87b903b Remove "2" from Qt Quick Controls directories
Qt Quick Controls 2 was named that way because it was a follow-up to
Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer
supported, we don't need to have "2" in the name. Work on this was
already started for the documentation in
1abdfe5d5a.

By doing this renaming a few weeks before feature freeze, it won't
affect the release but still results in as little time possible spent
manually fixing conflicts in cherry-picks from non-LTS releases as a
result of the renaming.

This patch does the following:

- Renames directories.
- Adapts CMakeLists.txt and other files to account for the new paths.

A follow-up patch will handle documentation.

It does not touch library names or other user-facing stuff, as that
will have to be done in Qt 7.

Task-number: QTBUG-95413
Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-12-01 10:26:20 +08:00
Fabian Kosmale 1cae237329 Fix build error in top level builds
We need to set up autogen tools not onlyfor the main library but also
for the plugin.

Fixes: QTBUG-109010
Pick-to: 6.4 6.2
Change-Id: I72b64c3803eb1de5f07e8dde05b87d95bc5dc7f2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-29 14:46:34 +00:00
Ulf Hermann 43ef237f99 qmltyperegistrar: Generate accessSemantics="none" for foreign namespaces
If the local type is a namespace, the resulting type can only be a
namespace, too, no matter what kind of tag the foreign one has.

Furthermore, we can re-use types with other QML_* tags this way.

Task-number: QTBUG-108883
Change-Id: Ib2ae08d5b081b8faa35124314f97d406d7b4f76f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-11-29 12:32:27 +01:00
Fabian Kosmale 6656567a40 Introduce type based overload of Qt.createComponent
Add type based createComponent overloads based on
QQmlComponent::loadFromModule. They provide a way to instantiate a
component by its type, specified by  a URI and typename pair.
This enables creating Components for inline component types and C++ only
types.
Support for directly passing the type is deferred to a later commit, as
it needs some care to work together with the compiler.

As the string based overload matches a mistaken call to the URL based
createComponent with parent and mode swapped (due to anything being
convertible to string), we add a check to detect this specific error
case and give a helpful error message.

[ChangeLog][QtQml] Qt.createComponent now supports creating a Component
from its module and type name (passed as strings).

Task-number: QTBUG-97156
Fixes: QTBUG-26278
Change-Id: I89e7430fe02d52f57230bfa1b0bfbcbfd0ead4b7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-11-28 17:10:07 +01:00
Fabian Kosmale 6cd8d209ec Connections: Don't crash when target is deleted
Pick-to: 6.4 6.2
Fixes: QTBUG-108697
Change-Id: I019edf3a0a702ad1dca340473265933e4d131e99
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-11-28 13:12:02 +00:00
Ulf Hermann b6ba7e9c90 Key required properties by object and property data
Property data alone is not enough as the same property can be required
in multiple objects.

Fixes: QTBUG-108291
Change-Id: I3b1c899e24bb2967d05372701f9b5d0927b3c711
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-11-28 14:11:44 +01:00
Ulf Hermann 6acf343acb Loader: Create bound components into their creation context
It's unclear why we need a separate context for the created objects in
the first place.

Fixes: QTBUG-108684
Change-Id: Id6213a8cc61f54064162e7caa26ec7a6b38ddc2b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2022-11-28 14:11:34 +01:00
Maximilian Goldstein 46429839fe QtQml: Restructure the module
Create a new module QtQml.Base which contains the actual QtQml types
and a new module QtQml that just imports QtQml.Base, WorkerScript and
Models. This is so we don't have circular dependencies within QtQml
anymore where QtQml imports QtQml.Models but Models can't depend on
QtQml for type information.

[ChangeLog][QtQml][Important Behavior Changes] If you import QtQml you
now need to make sure that QtQml is actually in the import path. Usually
this is the case, but by manipulating the import path you can hide
QtQml. In previous versions of Qt you could then still import QtQml
because its types are present in the QtQml library. However, it would
ignore its dependencies: QtQml.Models and QtQml.WorkerScript. If you
really want to import only the builtins, you can always "import QML".

Fixes: QTBUG-105240
Change-Id: Icdcdcc926757a8e9e8d639301b5b6d110de59613
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-11-28 14:11:21 +01:00
Mitch Curtis 0765c176e7 Fail on warnings for simple "default" controls tests
This patch:

- Adds a simple, "default-constructed" (i.e. little or no properties
  set) test function for each control where one was missing.
- Causes those tests to fail on any warning.

It would be simpler to just call failOnWarnings(/.?/) in the
initTestCase() of each test, but there are too marning warnings to fix
right now.

Task-number: QTBUG-98718
Change-Id: Ia3aa901feab5db534925824528caf25297e02760
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-28 10:10:43 +08:00
Shawn Rutledge 20e745bbd8 Add qCDebug to tst_QQuickPinchHandler::scaleThreeFingers
When it fails locally, I want to see the actual scale value.

Change-Id: Iecdf1dc2bb9660d3f6d11dea57fb2ca5aafd0068
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-11-26 23:44:22 +01:00
Ulf Hermann 79e1b8da06 QML: Fix casting between builtin types when constructing value types
Amends commit 3195b44e1c.

Task-number: QTBUG-108789
Change-Id: Ie11c48d64e7984ee0e1982cb9e8241b815d8c49c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-11-26 15:45:10 +01:00
Semih Yavuz fe32f58008 Debugger: Initialize scoped context correctly
Initialize scopedContext with valid qmlContext. Otherwise debugger
crashes on attempt to lookup an object that includes a v4Function
property

Pick-to: 6.2 6.4
Fixes: QTBUG-107607
Change-Id: Iea59bdf9d379a5415abe1767f76f851978b1be3f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-11-25 15:47:00 +00:00
Richard Moe Gustavsen 2becb1c207 QQuickTableView: respect activeFocusOnTab
QQuickItem has a activeFocusOnTab property
which should also be respected by TableView.
When disabled, TableView should not transfer
focus between the cells when the user
hits the tab key.

Change-Id: I234286926b58753fa50923321302d4fa108a4515
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-11-25 00:04:03 +01:00
Ulf Hermann 6e640a0218 QmlCompiler: Store imported types in a QList
The same type can be exported multiple times with different attributes,
even in the same module.

This requires us to fix directory imports as qmllint otherwise complains
about SegFault.bad.qml and SegFault.qml being the same type (which they
obviously aren't).

Task-number: QTCREATORBUG-27590
Change-Id: I295d927b9a07acbb715055a6883ac44b50129c2d
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-25 00:04:02 +01:00