We need to figure out if the input is also a list, iterate that if
necessary, and deal with the various QVariant cases.
Amends commit b0fc028cb5.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136566
Change-Id: Iab7c2d18b7049eecd0327cbdb7e7c7592b2d2ad3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
When using private features like qml_xml_htpp_request, we need to
include the private config header.
This was most likely hidden in PCH build, as those would have added it
transitively.
Amends 8effdd97d9.
Pick-to: 6.10
Change-Id: I935c4ca6f17dcb334e934b28c932a4d5525dd287
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
So far, resolving the id of a root element would have yielded the base
type, which is problematic when you want to expose a property of the
new type initially pointing to that id (as we do in some examples).
Fix this by inserting a mapping from the element to m_exportedRootScope,
which is the scope of the actual root type.
This is similar to what we do with inline components.
Some care needs to be taken, though: if the file name does not yield a
valid QML type, this export should not happen. We also must be careful
to do this early, before processing non-base imports, otherwise we would
end up shadowing types with the same name from explicit imports (e.g.
there's a Connections.qml file in the qmltc test suite using Connections
from QtQuick). We also must not expose types which are lowercase; not
only are those not importable according to QML semantics, but we'd also
would run into issues with "var.qml" shadowing the var type.
Pick-to: 6.10
Fixes: QTBUG-138515
Change-Id: Ie4a2c160cf9eda847da87816a88b17f6a5f3a8a3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
In QQmlJSImportVisitor::processPropertyBindingObjects, we can encounter
grouped properties. So far, we used the whole compount expression to
look up the property. That would of course not find any property.
We now instead traverse the individual parts of the name, and look up
the property chain correctly on the corresponding types.
We adjust the previously added test for unknown duplicate properties to
work with _really_ unknown properties (that don't exist), and instead
use an adjusted version to prove that the example is completely warning
free – mirroring the issue from QTBUG-138164 in a more minimal way.
Task-number: QTBUG-138498
Task-number: QTBUG-138164
Pick-to: 6.10
Change-Id: I75d17c3c412159f3f6da082f54d99bdf6b3b08e4
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
So far, nativeText and portableText only considered the singular key
`sequence` property; however, we nowadays promote `sequences` in the
case where you have multiple possible values (which notably happens
when using StandardKey enum entries that map to more than one entry).
To fix the issue, we pick the first entry of the `sequences` list
if it is non-empty, and otherwise fall back to the existing `sequence`
member. Moreover, we decouple the change signals for the two text
properties from the `sequenceChanged` signal, so that we can also signal
a change when `sequences` changes instead.
Amends 15a07dbd30
Pick-to: 6.10
Fixes: QTBUG-96350
Change-Id: I49f9b5a17020a8417a95652c759756cc7fdda1b1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The function name had a spelling error. This change improves code
readability and follows Qt naming conventions.
Fixes: QTBUG-138625
Change-Id: I91c1153e028b5095ba913f2c7a74e7ce762ff279
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The _qt_internal_write_qmldir_part function is
deferred to be called in the root CMAKE_BINARY_DIR, where
QT_CMAKE_EXPORT_NAMESPACE is not defined if find_package(Qt6) is not
called in the root of the project.
Make sure to pass the value of QT_CMAKE_EXPORT_NAMESPACE to the
function explicitly, from a scope where it is available.
This avoids errors like:
CMake Error at Qt6QmlMacros.cmake:155 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:::qmltyperegistrar>
No target "::qmltyperegistrar"
As a drive by, do the same for _qt_internal_deferred_aotstats_setup
and use that variable, instead of the hardcoded Qt6:: prefix.
Add test.
Amends b47555feff
Amends f2889262c8
Pick-to: 6.8 6.9 6.10
Fixes: QTBUG-138559
Change-Id: I9ecf2149737f3522fa61b7188403c8470b5a15d3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In QML, one can use XMLHttpRequest. Not so with a plain JS engine. The
reason for that lies in the fact that a JS engine did not have any
network access, because all network functionality was in the type
loader, and the type loader was coupled to the QV4::Engine.
This has changed in d2bc4a4330, but we
stil don't expose XMLHttpRequest to a plain QJSEngine.
Nevertheless, it conceptually lives in the global object, and we need to
collect information about it to enable code completion and linting.
Consequently, expose a function in QV4::Engine, which allows us to
manually trigger the registration, and call it in qmljsrootgen.
Going forward, we should arguably have a QJSEngine::Extension for
XMLHttpReuqest, after which we could remove the hack.
Note that as before, qmljsrootgen prints a few warnings, because we call
functions in contexts in which they must not be called. As before, we
ignore this for now.
As a side-effect, this adds a few more entries to the qmltypes file for
new entries on the global Qt object.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: I21e9d62bf075e8d4356db8f357502feb927717e7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This takes the code that was originally going to be BorderShape
and merges it into RectangleShape.
Fixes: QDS-15299
Change-Id: I8c1133ee5d916b46ba37b852a069b2034eee5a03
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
As a sanity check to confirm that this works for a related follow-up
patch.
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Ic62c19ba33bd24f0855a224d8120a9b4a324bc9b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
It seems that our attached scopes have no base type: they don't inherit
the attached properties or methods because their baseTypeName is not
set.
Therefore, set their baseTypeName, and move the resolveTypes calls
inside of setScopeName() instead of potentially forgetting them after
enterEnvironment/RootScope() calls.
With the (resolved) base type, we know about inherited signals, like
in:
```
Keys.onPressed: { /*here is the "event" argument available*/ }
```
for example where we can insert the "event" JS identifier inside the
QQmlJSScope of the block of the signal handler, now that we now that
"Keys" has a "pressed"-method with one argument "event" on its base
type.
Add a test to make sure that the body of an attached signal handler
contains the JS identifier of the arguments of the attached signal to be
handled. This JS identifier is used later on in qmlls to provide
completions in the body of the attached signal handler.
Also fix LinterVisitor::leaveEnvironment() that starts complaining
about "Component" attached properties that have no child, now that
attached properties have base types.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137736
Change-Id: I8de0158ca9946d5e0e4f4f0a46614385f0edca69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It was possible for a handler to not be added to its parent item via
data_append() when the handler is created as a property binding:
```
Item {
id: parentItem
property HoverHandler handler: HoverHandler {
parent: parentItem
}
}
```
In that case, the HoverHandler won't be added to the parent item's
default list property (data), since it's being assigned to a different
property instead (handler).
data_append() was the main way that pointer handlers installed
themselves to items, but it is skipped in this case.
Now we also call QQuickItemPrivate::addPointerHandler() in
componentComplete() if the pointer handler was not already added.
Pick-to: 6.10
Change-Id: I5c797f6abcfb19af7e897354fba39dd536e66140
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The new highlightedIndex property enables control over the highlighted
item in the SearchField. This property follows the same logic and behaviour as the Combobox's highlighted API.
Fixes: QTBUG-137862
Pick-to: 6.10
Change-Id: Ifb2a4fd52f126c6ea6b7e36b2b47e4b0f0115428
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Return structured result instead of bool from search(). Update search()
and read() to adapt the return. Add an isValid() convenience method to
return type. Refactor search implementation into separate helper
methods.
Task-number: QTBUG-107212
Change-Id: I858951f0d4a7714eff01a3e6fcf96f92e2684ae1
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
When file selectors are used, we loose too much information currently,
as we completely discard everything we know about the type.
[ChangeLog][qmllint] qmllint and the LSP now no longer print warnings
about ambiguous types if file selectors are used, and instead use the
"plain" version. The QML script compiler will still conservatively
reject such QML files. If warnings about such cases are desired,
the new "importFileSelector" warning category can be enabled.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: Ia87d5ab62003fe8d7d2ab9569fac2942fb1c7c14
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
If we have no clue what a certain property might be, do not warn about
duplicate binding assignments to it.
It might be a genuine error, but it might also be:
- a property of a type we couldn't resolve; that should warn about the
type, but not here – it might after all be a list property if we were
able to resolve the type
- a binding assignment to an instance of a custom parsed type
Note that the attached test case currently would still complain about
the property being unknown, as it fails to correctly handle the grouped
binding. That will be addressed in a follow-up commit; for now we
silence that additional warning with a qmllint comment, putting the
focus on the duplicate list warning.
Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: Ib06a4baaef0813a45a20738cbb6efe4cf5e5952c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Using attached properties in PropertyChanges is not the most common use
case, but it is supported. It should thus not create any warnings.
In general, any custom parser can do whatever it desires with the
bindings it receives. Consequently we skip validation of attached
properties when inside a custom parser.
Task-number: QTBUG-138164
Pick-to: 6.10
Change-Id: I5a523518b6983adb96c2e1ccac7d7944c1956aa5
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Implement go to definition for singleton types defined from C++ or QML.
Fixes: QTBUG-130801
Task-number: QTBUG-128393
Change-Id: Ib1f44886d2028c23ef60084ff045b44e99d897bc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
ImHiddenText when using the password echoMode makes virtual keyboard
unaccessible if not tagged as accessibility tool, such as the gnome
keyboard for example.
Remove it to enable the use of virtual keyboard.
This change does not have any effect on the text displayed and does not
impact the security/confidential aspect when entering sensitive data in
a textInput.
Enable users who do not have access to a physical keyboard to still
input senstive data, such as passwords, on their machine.
Characters are shown as bullet dots with or without this patch, disregarding what the ImHiddenText flag might suggest.
Fixes: QTBUG-88367
Change-Id: Ifd2a45e90ae022139a8ca89401b278e35bdc6a03
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
That's more readable than explicitly initializing badMessages and
replacements, and is used by the following commit.
Pick-to: 6.10
Change-Id: I11be2ab0f547364d8cb7600844c2fe2817dd47fa
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Test copies Android assets to the Android application build directory.
If the QT_USE_ANDROID_MODERN_BUNDLE is enabled application build
directory is different and we should use
_qt_internal_android_get_target_deployment_dir to get it.
Change-Id: I0e02279aa289fbc5b8e0a00bd444604f7ca91e7a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_qtquickview_basic and tst_qtquickview_signallistener
use custom android deployment procedures which require update
to support modern Android bundles. Disable the option for these
tests.
Change-Id: I1fe36f4156e655c0e551f280b9b8259617948b9f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
We need to actually defer the code which attempts to detect whether we
are linking against QtQuick to the point where we write-out the file, as
the user is not unlikely to use target_link_libraries _after_
qt_add_qml_module.
Amends 065b784cab.
To test that this works, we run the all_qmllint target of on an example
project. We need to add a .qmllint.ini file to let qmllint fail the
build if there are any warnings.
Pick-to: 6.10 6.9 6.8
Change-Id: I7e00583b3a5b38549db2be13b1a8817b8489496d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The delivery agent generally accepts key events before sending them to
the quick item; the corresponding item can further accept or ignore
those events.
The reason that the user can't override the shortcut key event in the
quick text edit is that these events are marked as accepted by default
in the delivery agent, and the quick text edit also doesn't explicitly
handle the read-only case, which causes the event state to remain as
accepted.
This patch ignores the shortcut override event by default in the
delivery agent. Also, make the quick text edit to execute the
configured key handler to either accept or ignore before processing
the events. This gives the chance to execute the required shortcut
actions.
Fixes: QTBUG-136959
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ib6400f083f4e21d1b23db87b002acb1cbd4ac82b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Some of the tests currently use environment variables to configure the
garbage collector.
In doing so, the test indiscriminately unsets those configuration
variables on exit, which has the side effect of possibly unsetting them
even if they were set outside the test case itself, and especially could
unset them for later test cases, possibly affecting them.
To avoid the issue, the test cases now configure the GC through the use
of private API instead of indirectly passing by the relevant environment
variables.
Change-Id: I3b20badf754638dc8e4206de711c214e13e78c1d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Currently when a JITtted function throws an exception, on exiting, the
accumulator is not zeroed-out if we don't have an exception handler and
is zeroed out when we do have an exception handler.
In the case where an exception handler is missing, this means that if
the caller is making use of the result of the function call, it might be
dealing with garbage memory.
Many times this isn't an issue as the result of the call would correctly
be ignored in the face of handling the presence of an exception.
Nonetheless, not directly using the result is not necessarily enough to
avoid issues with the possible garbage.
In particular, if the result of the call is put on the JS stack and
handling the exception allocates, the GC might be run as part of the
allocation and read the elements on the JS stack, one of which would be
the garbage memory that was returned.
One case where this can happen in the current code-base is during the evaluation
of a non-signal `QQmlJavaScriptExpression`, which does put the result of
a call on the JS stack while later handling an exception in a possibly
allocating way, with the garbage result still on the JS stack.
Furthermore, the interpreter currently isn't affected by the same issue,
as the interpreter always zeroes out when unwinding without running an
handler.
This adds the additional problem of the behavior differing between the
an interpreted function and its JITted version in the face of an
exception when the result of the call is voluntarily or not inspected.
To avoid the issue, the code generated by the baseline JIT was modified
to always zero out the accumulator before exiting a function call after
an exception, independently of the presence of an exception handler.
This further aligns the behavior of a JITted function to that of the
interpreter when no handler is present.
A test was added to `tst_qqmlecmascript` that exemplifies the issue by
passing by `QQmlJavaScriptExpression::evaluate` with a JITted throwing
function.
Fixes: QTBUG-138242
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I969dc790f8a274364ae124afaeae8e2381fc82ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
It makes no sense to prohibit multiple imports of the same QML module
with the same version. We can just re-order the imports according to
prcedence when we detect this.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138391
Change-Id: I5ad94e1181f6a2beb278e421c1bbf06678fd863b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Doing this on the debug server thread can cause deadlocks since we may
need to serve a file request stemming from type registrations that also
lock the QQmlMetaTypeData.
Amends commit 618720a3a9.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138349
Change-Id: Iaa6c8cbf9270989aeca0cb84a4a77cd2aee36804
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The current btoa() and atob() perform UTF-8 conversion of the data and
therefore produce different outputs than the relevant Web APIs. That's
not helpful for a format which was explicitly invented for data
exchange. However, since they are compatible with each other, we cannot
simply change their behavior.
The actual problem stems from the fact that those functions take strings
as their inputs. Strings in JavaScript as well as Qt hold 16-bit data,
while base64 can only process 8-bit data. This makes it necessary to
deal with invalid characters in the first place.
Add additional overloads that take QByteArray. At least for btoa() we
don't need to check the input for compliance this way. However, since
it's difficult to obtain a QByteArray for random data in JavaScript,
also add overloads that take a few more common array-likes and convert
them. These overloads actually check the data for compliance and throw
the "Invalid character" excpetion if it's found to be non-compliant.
In turn, deprecate the broken implementations and print a warning when
they are used.
[ChangeLog][QtQml] The Qt.btoa() and Qt.atob() methods were subtly
broken and produced different output than the common Web APIs. They have
been deprecated in favor of overloads that take array-likes.
Array-likes, especially ArrayBuffer, are a better fit for expressing raw
data than strings.
Fixes: QTBUG-135329
Change-Id: I4d48c84b3a87cb615f78aa1a8c1eddfedcd306f9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Some comments and header guards still had V8 in them.
Change-Id: I71e888fb72916fcd948a293d9fd50fb54a9499c3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
If we get the same file twice, that's generally the effect of a linkage
cycle. Either we're dealing with a static build where this is fine and
we don't need to complain about it, or the linker will complain anyway
and we don't have to.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-132518
Fixes: QTBUG-127133
Fixes: QTBUG-134292
Change-Id: Iad8b3b5c694d96ebdcbf03522ce2318ae8d24fb2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It doesn't cause any harm if we are not inside a binding. There's a
slight issue with the fact that we now don't warn if one extracts the
read into a separate function, and calls the function inside a binding,
but that is still better than spurious warnings.
Fix this by checking in which context the read occurs. We currently rely
on a "magic" name we give to the function's scope if it as a binding,
but this will be fixed in a follow up commit introducing new scope
types. We don't want to do introduce them here, as they would be new API
not suitable for picking back to 6.10.
Another open issue is that the onRead handler gets the outer QML scope
as the context, which necessiates that we traverse its child scopes to
find the actual function. Fixing that would necessiate some larger work
in the QQmlTypePropagator, and is consequently deferred to another
patch, too.
Pick-to: 6.10
Fixes: QTBUG-138346
Change-Id: I29ea39eb32a18d9b54ded8d5e2c9a5f66051374f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The manual test svg was renamed, which breaks builds with manual tests
enabled.
Amends 7b44231f33
Pick-to: 6.10
Change-Id: Ib03e4036718c49297e88ab35c43aa411963a41a1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The non-native quick dialogs don't block input to the windows even after
setting the modality as ApplicationModal/WindowModal. This is because
non-native platform dialogs (QuickPlaform*Dialogs) didn't set modal to
its respective window (QQuickPopupWindow).
This patch fixes that issue by setting the modality to the non-native
platform dialogs.
Task-number: QTBUG-127605
Pick-to: 6.10 6.9 6.8
Change-Id: Idb3374e881766ae92adc0360c9b9af5c498dd6df
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
It is actually possible to have mutliple ValueSources on the same
propery, as long as they are not all active at the same time.
We can't really know whether that's the case (that can only be known at
runtime), but we can employ a heuristic to avoid most spurious warnings.
Pick-to: 6.10
Task-number: QTBUG-137946
Change-Id: Ie39a1368c68e1ba9aecf582df00680ae3e8c68f3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Previously, QQmlTypeLoader had different cache entries for
directoryExists() and fileExist() in the same cache. The ones for
fileExists() had an extra slash appended to their path.
This was entirely pointless because a path is a path and if it exists,
we can use it for file lookup. Furthermore, it was wasteful because it
halved the capacity of the directory cache while adding duplicate keys.
However, it did mask one bug: The entries for directories could stay
unpopulated without disturbing the ones for files.
The masking was not complete, though. When inserting a directory entry
that ended in a double slash, one of the slashes was removed, leaving
the entry in the form expected for files.
Now we always remove all trailing slashes, and always populate the cache
when an entry is first inserted.
Task-number: QTBUG-134652
Change-Id: I333c81655d6f6dfff1e46dae8eef3c46a33d97ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
tst_MouseAreaInterop::
dragHandlerInSiblingStealingGrabFromMouseAreaViaMouse is flaky on
openSuSE 15.6 and is blacklisted on that platform.
Fix flakiness on openSuSE and unblacklist the test.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I1f0c8935a1b95d773cf5364ec4eba0c20918d41b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The safe areas require recursive layouting of the ApplicationWindow
menu bar, header, and footer (in particular). We added guards preventing
that in 6dc9539979, to fix QTBUG-87708,
but the fix for that can be in QQuickLayout itself.
Pick-to: 6.10
Task-number: QTBUG-87708
Change-Id: I0dc25d779fe76619591f35063826d50dff2e3d28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
tst_QQuickTextEdit::largeTextObservesViewport is flaky on openSuSe and
fails.
Verify the window is active after being shown before continuing with
the test.
Pick-to: 6.10 6.9
Change-Id: I2c842338ffdbe7be466060e0260ae92759da0b34
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
tst_QQuickDrawer::position is no longer flaky on openSUSE-leap.
Change-Id: I6ee5a0c8feda87f24ff9a07227a6fffdec27524b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
We need to check the existing path elements before adding the new one to
determine whether we need to connect the new one.
Amends commit bc58686176.
Pick-to: 6.10
Fixes: QTBUG-138233
Change-Id: If99bbd5ad6f4646e4a36c94d547f6bdc1fb73542
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Implement go to definition for components defined from C++.
Add a helper method in QQmlCodeModelManager that returns the workspace
with the shortest url that contains a file: this workspace folder is
used when searching for headers referenced by .qmltypes files.
Task-number: QTBUG-130801
Task-number: QTBUG-128393
Change-Id: Idaac7dcf9d71701a01533ceaaec31d8f142f99ab
Initial-patch-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add a method that returns the project root for a file. The project root
is the workspace with the shortest url that contains some file.
This will be needed when searching for C++ headers, as they might be in
a different subproject/workspace than the currently edited file.
Task-number: QTBUG-128393
Change-Id: I63ce3895abb20c9851dc77da3b4d0c4bd267c871
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Limit the file recursion in findFilePathsFromFileNames, and allow users
to modify the limit via environment variables. Implement the code inside
a static findFilePathsFromFileNamesImpl method that will be reused later
when searching for a C++ header for go-to-definition.
Task-number: QTBUG-128393
Change-Id: Ic5ba5929329434e079c70bdee9c2c2d343d381d5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This is not needed by our own tooling, and in the case of major version
only imports might lead to funny results.
It is however used by Linux distro tooling, and can't cause issuse with
older QML projects that never used the more advanced import features.
The feature is only enabled when the add-version flag is passed, as we
don't want to risk confusing our own tooling which might not expect the
value to exist.
Amends 6aa4c83bdb
Note that we need to adjust the rootPath.json file, as the new file
causes us to find more modules.
Pick-to: 6.10
Fixes: QTBUG-115170
Change-Id: I20d39dacc87f18fc5bbec93aaec5bdaef0c77c4b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
According to Qt6 best practices these are usually leftovers from Qt5.
Task-number: QTBUG-137746
Pick-to: 6.10 6.9 6.8
Change-Id: I7df6b16bf2a1c8fbd13a80c0ca4cb77583f07d42
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Flags declared with Q_FLAGS lack the methods for properly extracting the
typedef'd name. We need to manually register the typedef.
Amends commit 8bf5aae19b.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138174
Change-Id: I7c373f4d810a0c9a5590f39cc629015662a69ed4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Add Component line number information from MOC into QQmlJSScopes. That
is needed for qmlls to find definitions of QML components defined in
C++ headers.
This change adds the line number information into the generated qmltypes
from MOCs JSON, and reads it back into a QQmlJSScope.
Instead of adding an extra member, re-use the QQmlJSSourceLocation that
is inside the QQmlJSScope. Set the column to 1 for it to be valid and
to simplify some code on the qmlls side. This allows to treat a
sourcelocation in the same way, independently if the component described
by the QQmlJSScope was defined in QML or C++.
Avoid an assertion in QQmlJSImportVisitor::checkRequiredProperties()
where printFix assumes that a file can be opened if its source location
is valid: this change adds have valid sourcelocations to qml components
defined in C++, but QQmlJSScope::filePath() can't be opened because it
only contains the filename, not the file path.
Task-number: QTBUG-128393
Change-Id: Idf4acc32cff60730528322286ad4ba726b502ac1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This has the benefit of being case sensitive even on case-insensitive
file systems. Since the creation of a QDirListing is more expensive
than simply checking for existence with QFileInfo, we use the iterator
to its maximum effect and more aggressively cache directory contents
now.
Task-number: QTBUG-134652
Change-Id: I4b707d2adc5492f90466b831a14f17efa26a50c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Create a new macro that skips the test, and use it consistently around
the tests, instead of sometimes skipping and sometimes failing the
tests.
Also add a macro that prints the same message and returns false for the
generateCpp and generateCache helpers, to help in the case someone
forgets to add the skipping macro to their new test.
Change-Id: I91d35a32f345df1ebb0616046923a8c9b6b515e6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Now that we have introduced QQmlCodeModeManager, we don't need to
support multiple rootUrls in the same QQmlCodeModel. Make each
QQmlCodeModel have one unmutable rootUrl.
Task-number: QTBUG-137869
Change-Id: I474cbd2d3b72bd511c3f4a643cb99d5e141f7f2c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Move the code that opens the initial workspace into WorkspaceHandlers.
Add support for some deprecated ways of declaring the workspace root
folder in the LSP.
Also use workspaces in tst_qmlls_modules, instead of using a deprecated
rootUri.
Task-number: QTBUG-137869
Change-Id: I8ce5334fcc459493b6f165b0166e7a6bdeaee142
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Replace all usages of QQmlCodeModel with the newly introduced
QQmlCodeModelManager, and add qmlls tests for the WS feature.
Adapt the calls to m_codeModel->registeredTokens() and helpManager
to pass the uri so the manager can call the method on the correct
codemodel.
Add tests where qmlls is run on multiple workspaces.
Fixes: QTBUG-134308
Change-Id: I6ba918bd37f78f892bfaead86a0e216cbca7d7f1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
qmatrix4x4.h will lose its qquaternion.h include, so include
qquaternion.h explicitly in all files that mention 'QQuaternion',
unless, for a foo.cpp, the own foo.h has already included it.
Picking all the way back, even though the include removal won't be
picked as far back, because it's the correct thing to do and cannot
fail.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I21bc2ddfda326455d36d5510df596169e1c2d5dc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Container's removeItem function removes and deletes items immediately.
This has caused issues in the past, like QTBUG-46798. QTBUG-133256 is
similar to that, except it also involves transitions.
This patch fixes the crash by listening for the destruction of items
created within an ObjectModel and removing them so that views don't
have dangling pointers to them.
Add removeAndDestroyObjectModelItem to tst_qquicklistview2, which is
similar to the test added for 1e3924d8f5
but adds more thorough checks and transitions.
Fixes: QTBUG-133256
Task-number: QTBUG-46798
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I9777713edfc6f82a4e9edefe2fd6c9831f03c261
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
We want to respect the formatting and spacing of the user around
comments. Comments already contain the information about spaces and new
lines before and after them and they are included when writing the
comment.
However, this conflicts with the need the add spaces around tokens in
the non-commented case. We need to only ensure a space if it doesn't
come immediately before or after a comment since the comment already
includes the spacing. Otherwise we would be duplicating the spaces.
In order to do this, keep track of whether the last write was a comment
and defer actually adding the spaces until we know no comment follows.
This fixes errors where extra spaces were inserted around comments.
Tests needed to be updated to adhere to the rule that we respect user
spacing around comments.
The SpaceBeforePostComment option is also no longer needed now and was
removed. The remaining options were also renamed to better reflect their
behavior.
Task-number: QTBUG-133315
Change-Id: I38e7fb65ac76ead6287c9dcb2f43f8fdd09347da
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
When allocating an object on the JS heap the garbage collector might be
run as part of the allocation, in particular as a way to possibly make
space when the memory space is starting to get filled up.
When the garbage collector runs, it is possible, as part of its normal
processing, that it will access the JS stack, and try to interact with
the objects that are stored on it.
In particular, while collecting from the JS stack, the garbage collector
will need to mark all Managed objects that are found on it.
When allocating on the JS stack it is possible that the allocation and
the initialization of the allocated memory are performed in separate
steps.
When this is so, it is possible for the allocated element on the stack
to represent garbage memory in between being allocated and being
initialized.
Since the garbage collector can inspect all elements on the stack as
part of its processing, it is possible for it to inspect an element that
represents garbage memory if it runs in between the allocation and
initialization of that stack element.
Furthermore, since each allocation might run the garbage collector, then
any allocation in between the allocation and initialization of such a
stack element can access garbage memory.
In particular, if the garbage memory represents a pointer to a
previously existing Managed object that was swept, the garbage collector
might try to mark an object that shouldn't be marked.
There are a few cases of this currently in the code-base.
While instantiating a QML file, `QQmlObjectCreator` keeps track of
objects that are created in the process, to avoid premature collection.
As part of this, `ObjectInCreationGCAnchoList::trackObject` will be
called, in turn allocating on an element on the js stack and then
initializing it separately by the creation of `QObjectWrapper`.
The creation of a `QObjectWrapper` generally allocates, such that it can
incur into the above problem.
As part of dealing with the JS spread operator, in particular when
processing the spread element, we juggle with multiple allocation of
uninitialized elements on the js stack.
During this processing multiple part of the code can allocate.
For example, the spread element is handled through the use of an
iterator that, during its creation, might allocate as during the
creation process we might convert the spread argument to object so that
the iterator can deal with it, which would be the case for a spread
argument that is a string.
When allocating an element on the js stack that is bound to a certain
scope, we sometime allow a conversion to be performed on the original
element.
This conversion routine might allocate, and it does do so for the
currently existing conversion to a String and to an Object.
The conversion routine is called after an uninitialized element is
pushed on the stack, and can thus incur into the above issue.
To fix the issue, an additional method was added, `construct`, that
ensures that allocation and initialization happen sequentially with no
allocation in-between, using an initialization value that is passed as
an argument.
The new method was applied to the code affected by the bug, in practice,
reordering the operations in the affected cases such that the
bug-producing allocations happens before the allocation on the stack
such as to avoid the bug while keeping the same semantics.
An exception was taken for the handling of the spread argument, which
has a more complex control flow, where the solution that was used is to
initialize the memory to the empty value as part of the allocation.
A series of test cases showing an example of the issues were added to
`tst_qv4mm`.
The tests make use of the fact that we assert when we find a Managed
object on the js stack that is not in use, as that is a logical error
for the garbage collector, to observe the issue and are thus skipped
when assertions are not enabled.
Change-Id: Id478e16ee22e20e77d01fdfae9a0269d6d709892
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Ensure that we produce the correct directory structure for the
QML module. This suppresses the tooling-related warning.
Pick-to: 6.8 6.9 6.10
Change-Id: Ia391663806e4d3428ca3ae2a5bfa8dda95f833da
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This makes it possible to just use the arrow keys to navigate
back and forth between files, since doing this with the mouse
can get tedious.
Pick-to: 6.10
Change-Id: I48bd4c644d1acddb6b46293b72b154d4e87001a8
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
If components are unbound, highlight id's of parent component as
QmlExternalId.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Ibd95d927c4871d8ac3575b602b8a4973ecb699bc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Prior to this commit, we were performing semantic analysis for each
field in a property chain expression. With this commit, only do semantic
analysis for the first part of the qualified expression. However, methods
and attached type identifiers are exempted from this rule.
Introduce new highlighting type FIELD which represents the fields in the
property chains. In QtC, they will be mapped to C_FIELD type while other
IDE will highlight them as PROPERTY (Accoding tot VSCode Semantic
Highlighting Guide, the property semantic token type is intended for
non-static member variables and member fields. Fields, therefore, align
better with property type. .
Add debug helpers to test.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Id49adf461e3a6cc6c0c32ebd33bbe082d420d71b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Let visitor own the highlights data and invoke visitTree in the
constructor. This makes it more structural and easier to test. Rename
highlights() into tokens() to prevent confusion, as the owner class'
name is also Highlights.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Ifed9a40c04fa1a86c3314bd172995246208a4756
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Currently, the tab navigation order is confusing as the footer is
focused before the actual content of the ApplicationWindow. By adjusting
the stack order, the tab navigation now matches the visual order.
Fixes: QTBUG-137823
Pick-to: 6.8 6.9 6.10
Change-Id: Ibe6fe9305181fe7ed42d7f8ca2da689b1b6ccf41
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
When trying to resolve all aliases on an object, we iterate over them
one by one. If all are resolved successfully, we return
AllAliasesResolved and consider this object done, if an alias fails, we
return NoAliasResolved or SomeAliasesResolved and we will try again
later. This can be the case for aliases to aliases. We defer resolving
the first one until the target alias is resolved first.
There was a bug in the logic that counts how many of the aliases were
successfully resolved and how many were skipped. When skipping an alias
to an alias, we cannot count it among the completed ones.
This leads to an alias not being resolved and added to the property
cache. Thankfully, a runtime assert then catches the discrepancy between
the number of aliases in the property cache and in the compilation unit.
Early exit when detecting that the alias points to a non-local
unresolved alias to try again later. Also update the aliasIndex as part
of the for loop update.
Amends 9e1378260a
Pick-to: 6.10
Change-Id: I6ee7a796a0b4890393d5b17ebea2686c55955394
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The path elements need to implement removeLast and replace. Otherwise
such operations are extremely slow. Furthermore, we can add nullptr to
the path list. Don't try to connect or disconnect those.
Pick-to: 6.10
Task-number: QTBUG-137554
Change-Id: I15352861d62f1b716954a482444fe71dc4518ea3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add a new QQmlToolingSettings class that locks all its methods. This
allows to use the same settings object in multiple qqmlcodemodel that
each loads files concurrently in their own threads, without data races.
Task-number: QTBUG-134308
Change-Id: I28664a8bd8fe755f21a9c5626d7b7b4fe3db15be
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Using one QQmlCodeModel is not enough to be able to support multiple
Qt projects opened in the same qmlls instance: different projects might
require different import paths.
The previous behavior is to load every opened file in the same
QQmlCodeModel, which means that all opened files end up in the same
DomEnvironment, and share the same (potentially wrong) import path.
This leads to bugs like QTBUG-137705.
Also, the QQmlCodeModelManager reads the .qmlls.build.ini files and
therefore can load different QML modules from the same project into
separate CodeModels. That should solve problems where different
QML module have different import paths, for example when IMPORTS TARGET
or DEPENDENCIES TARGET is used.
Therefore, introduce QQmlCodeModelManager, whose responsability
will be to manage the different code models that have different import
paths, and to "re-route" calls to the code model responsable for the
passed url.
QQmlCodeModelManager has almost the same public interface as
QQmlCodeModel: a later commit will swap all usages of QQmlCodeModel with
QQmlCodeModelManager. Some method of the public interface of
QQmlCodeModel, like fileNamesToWatch and ignoreForWatching for example,
seem to be only used in testing, so leave them out from
QQmlCodeModelManager. Some methods need an extra-url argument to be
correctly rerouted to the correct codemodel, like registeredTokens for
example.
Each QQmlCodeModel will end up in its own QQmlWorkspace.
We distinguish between two types of Workspaces: the client managed ones
and the server managed ones.
The client managed workspaces are passed via the LSP and are supposed to
separate different projects using potentially different qt versions,
like in the use case of the VS (non-code) extension. They can be closed
by the LSP client once they are empty. Closed client workspaces are not
used for opening new files, and are destroyed once they don't contain
any more open files.
The server managed workspaces are created from the found
.qmlls.build.ini files to handle different QML modules inside a project
that may have different import paths. Empty server managed workspaces
are automatically destroyed.
Task-number: QTBUG-134308
Change-Id: Ia873856fed96e88f04b46e13af6e16da0d2ee574
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Instead of just showing the current file in a label, make it a
combobox, so that you can skip directly to the file you want.
Pick-to: 6.10
Change-Id: Ia9c48414541bb3e8ad70d685e6e426446ce4c1a8
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Simply clearing the expressions is not enough. We might have internal
signal/slot connections in addition. The main protagonists of such
behavior listen to context invalidation, though, and a context without
engine counts as invalid. At the same time, we leave the context object
in place so that we don't re-open QTBUG-66822. The currently running
binding will still be able to complete this way.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-118188
Change-Id: Ia973be26f0e4e3244adc71f95df7e0b4bef412c3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
See comment on 455f3169e3 about throwing
during QVERIFY/QCOMPARE: The test framework will still record that there
was a failure, but without throw follow-up code will still be running,
which might obscure the failure reason.
Change-Id: I58a6e59a40369ef3a15ebb4707f0140c5827212b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
To test (show) the current tab order behavior, the ApplicationWindow
of the autotest is extended by setting the menuBar, header, and
footer properties. Consequently, the autotest will now test the tab
order by traversing all the ApplicationWindow's content. Additionally
the test now ensures correct z-stacking of the contents.
Cleanup QKeyEvent creation lines by removing redundant parameters and
use consistent assignment syntax.
Fixes: QTBUG-137823
Pick-to: 6.8 6.9 6.10
Change-Id: I156397c00c308e2abd5e1f0acefd4889330f7619
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Add more regions for comments to attach to.
Remove special casing preventing comments to attach to the braces of an
enum. It is no longer needed.
The comma token belong to the enum entry after it. The opposite was
assumpted to be true before which led to comments being attached to the
wrong item and moving around.
Task-number: QTBUG-133315
Task-number: QTBUG-123386
Pick-to: 6.10 6.9 6.8
Change-Id: I32f8c49aff6a4c88c323450beec9aa0f5bc5bbe5
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We already have a QByteArray that we can print directly, so no need to
go through a QString.
Amends 386e085114.
Task-number: QTBUG-133858
Pick-to: 6.10
Change-Id: I89768a1faf1ead2e763215348f8defbbeaeaa93e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The primary use case for this function is to print diagnostics in case
of test failure, so don't go through from UTF8 to QString and back,
and instead return a QByteArray directly.
Amends 386e085114 to address header
review comment.
Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: Id5e242be274ef173bc89e281e6e6db5ce758914c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Every LoggingCategory needs to have a name. However, it might be used
before QQmlParserStatus::componentComplete has run. In theory, it might
even be used before the binding has been installed.
To fix this, force the completion logic to run early if the category is
used.
Given that the name of the logging category must never change, we make
the assumption that no complex bindings are used for name, but only
literal strings. Consequently, we don't introduce the overhead of
flushing bindings, which would be necessary if we were to support them.
Fixes: QTBUG-116539
Pick-to: 6.10
Change-Id: Ic194a7dcbae25b5f982198e9ea27f806c84e5cac
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Do not allow Qt Event Loop to continue spinning until the
QtQmlStatusChangeListener has been notified about the status change in
QQuickView or 1000ms have passed, whichever comes first.
This timing issue could cause signals to not be received by the user in
cases where QML signals were fired too quickly after the QML view was
done loading, especially if the Android UI thread was under high load.
This was due to the fact that the QtQmlStatusChange event was queued on
the Android UI thread, after which the Qt event loop was allowed to
keep spinning, emitting signals and such. In cases where the Android UI
thread was under load, processing the queued QtQmlStatusChanged event
could take long enough to lose the earliest QML signals. This was
detected on the CI Android emulators during signallistener tests.
Fixes: QTBUG-137025
Change-Id: Ibf04b71a556a7e4a2b5b0338e6ac7876b0228ae1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit adds support for QML signals with multiple arguments to be
used in the QQ4A context.
In the QtQuickView[Content] layer, this commit adds a new overload for
the connectSignalListener API. This new overload takes a Class<?>[]
parameter instead of the Class<T> parameter of the old API. To support
this, the corresponding QtAndroidQuickViewEmbedding native function has
been replaced with one that takes a jclass array as well. There is a
new implementation for the old single-class-argument API that calls the
new API, instead of reimplementing the logic in two places.
Signal connection and disconnection logic has been moved to
QAndroidViewSignalManager, which is called from the
QtAndroidQuickViewEmbedding namespace native functions.
In QAndroidViewSignalManager, the signal connection now happens by
connecting to the qt_metacall QMetaObject function, which the class has
overridden.
In QAndroidViewSignalManager::qt_metacall, the signal is handled by
detecting the type of signal and parsing the data sent by the signal,
either by reading the property of the sender of the signal that the
signal is linked to, or parsing the void* arguments passed into
qt_metacall.
Task-number: QTBUG-124489
Change-Id: I416bb266b3ffe5c947264d942b1afe3349bca2d7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
We need to implement all the QQmlListProperty methods, and we need to
guard against nullptr to avoid crashes.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137554
Change-Id: I9a222085b4848a9f0ebe59d9e029cabdedc46512
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
When a QDate is passed to QML, it becomes to a JavaScript Date.
As Dates are stored in local time, the QDates we were passing to
QML had the potential to be one day off in certain timezones.
For example: 00:00 UTC converted to UTC-8 is 20:00 the day before.
Fix this by storing and providing dates as QDateTime so that we can
give it a time of day that can't possibly result in a different day
when converted to local time. It's fine to change the C++ API since
it's private, and nothing will change for the type that users see,
since they always get a Date.
Add a SystemEnvironment singleton to QQuickControlsTestUtils
(Qt.test.controls) to allow reading and writing environment
variables from QML.
Fixes: QTBUG-72208
Pick-to: 6.8 6.9 6.10
Change-Id: Idb4ab26568d8f1eddd5ab4cebe691e38173d02a9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Value type proxy bindings don't set the binding bit in the first place.
Therefore, we'd never find one this way. When different bindings set
properties of the same value type property in different places, this
would crash.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137326
Change-Id: Ie5ddb840f3f056ce5c9e04689511986e0eb28123
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Now that we discern internal and external side effects, we cannot
implicitly rely on every jump to generate a side effect anymore. We need
to actually update the virtual registers and also merge the side effects
(along with other flags).
Amends commit 6b14ba5c2f
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: I6b46c7a4773759c8f6f30308ba72082555ce3e61
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
So far, self-referencing arrays can lead to infinite recursion in
Array.join. The standard allows us to throw an exception in this case,
just like we already do in ObjectPrototype.toString(). This is not what
browsers do, but arguably they are diverging from the spec.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-124157
Change-Id: Iac241a90ba7e583e53f52ec635add7b5cf05b200
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
JS variable declarations in a QML element are not allowed.
The engine rejects them in the IR builder. As the linter doesn't run
this part of the compilation pipeline, it would never report the issue.
This commit fixes the issue by adding the necessary check.
It also avoids an assert in insertJSIdentifier when assertions are
enabled.
Fixes: QTBUG-137030
Pick-to: 6.10 6.9 6.8
Change-Id: Iff7a6e02bf852cf3a9affcac6ec40b7bd98cda83
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
inlineConsoleMethod's stringConversion needs to create a string, so that
we can later append to it. Because we were missing parentheses, this did
not happen, and we would end up with code looking like
u']'.append(...)
which obviously isn't valid C++. Fix this by always adding parentheses
around the expression.
Found while trying to prove that QTBUG-109279 was fixed.
Task-number: QTBUG-109279
Pick-to: 6.10 6.9
Change-Id: I67fce5b2c1f1460a5d6b617824f3c36f9804ea76
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This now shows Lottie files as well, so it should have a more
generic name.
Task-number: QTBUG-135267
Pick-to: 6.10
Change-Id: Ibb6a17cf215dde7c0c32b4cdfd37e6227ec3cd9a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The QML generator code path in the test has some bugs due to how it
generates embedded images. In addition, it does not map to loading
other file types such as Lottie in the same application, since
that would need special handling.
Since it is now tested through the item generator (the item
generator uses it internally), we don't need a separate UI for
this in the test.
Task-number: QTBUG-135267
Pick-to: 6.10
Change-Id: I9e35bccebcd9e763c74ce44cf9d4e89fc0d1a802
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
tst_androidassets hardcodes the Android build directory. Use
_qt_internal_android_get_target_android_build_dir instead to evaluate
the path for qml assets.
TODO: Avoid using the private method in tests. See QTBUG-135973.
Change-Id: If65b6ea359a4ef4bddd8e76071cde46cea9ad5d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
It mirrors the same property from any own delegate model. If you
explicitly set an external DelegateModel to be used by the instantiator,
that one's delegateModelAccess is used. This is in line with how the
delegates behave.
The lack of the property in Instantiator is an API inconsistency and
therefore the fix has to be picked back to 6.10.
[ChangeLog][QtQml] Instantiator now has a new property
delegateModelAccess. Setting it to DelegateModel.ReadWrite allows you to
write values into the model via required properties just as you could
with context properties.
Pick-to: 6.10
Task-number: QTBUG-132420
Change-Id: I44b480182339bff8aef8aba385d2bde63f825ff9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When setting the accessible name for a QQuickAbstractButton,
don't include the ampersand ('&') character that denotes the
mnemonic character, and don't escape literal ampersand characters
by doubling them.
Use the same helper function also used by widgets in qtbase
to strip those extra ampersand characters.
Add a corresponding test.
Fixes: QTBUG-134208
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0da58564ef028cda3c1cc1cecbaacbb4e9d92c17
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit introduces a range of small unit-tests mostly focusing on
covering existing grammar rules with regard to property attributes.
This is a preparation step before introducing new keywords like virtual
and override.
propertyDeclarations test aims to test parsing of properties as isolated
as possible by employing parseUiObjectMember function of a parser.
Moreover additional test helpers like unified parseAs function and
Syntax::Phrase and Syntax::Word and corresponding toString* functions
provide an easier way to create and manipulate the test data, while also
minimizing the possibility of misspelled token / test data.
Task-number: QTBUG-98320
Change-Id: I0e2d916be7f848c4a8c312c3c0d09e71b97e9ffb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
When we reference glyphs in QSGDistanceFieldGlyphCache::populate(),
we do this before they are added to the cache, so the cache coords
have yet to be registered. So even for empty glyphs that cover a
0x0 area, they will be still be registered as referenced in the
cache.
However, when dereferencing the glyphs, we would skip if the glyph
did not occupy any space in the cache.
This asymmetrical behavior could lead to a glyph cache mistakenly
being counted as active even after deleting all nodes that reference
it were gone. Thus it would stay around in the glyph cache when it's
invalidated, even though all references are actually gone.
As a simple fix, we make sure the referenceGlyphs() and
releaseGlyphs() are always called for all glyphs. This means that
the list of unused glyphs may sometimes contain empty glyphs, so
when we recycle the unused glyphs, we need to make sure we skip
that for glyphs that do not occupy any space.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-132108
Change-Id: I919d8b6a6a2de9bb1f0fccd7c6ffa00436e6ffa5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This allows defining easing curves from QML, which is useful
for e.g. FrameAnimation or use cases that require non-linear
progression.
[ChangeLog][QtQml] Added the easingCurve value type
and Easing singleton.
Fixes: QTBUG-137468
Change-Id: I2f9c4c2269c80c31a70700dd3a2475c53ba8a930
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If the context is gone, we are technically still able to evaluate
QProperty bindings, but we really shouldn't.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137270
Change-Id: I323c26d59788e4b318ec4733e1593e761beb4b6f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This makes it impossible to e.g. swap between two delegates.
Similar to 80f1186338 except for
QQmlComponents.
[ChangeLog][Controls][Important Behavior Changes] Old QQmlComponent
delegates (not the item instances created by them) are no longer
destroyed when a new one is set, as they are technically owned by user
code. They will still eventually be garbage-collected as expected,
assuming there are no references to them.
Fixes: QTBUG-137777
Change-Id: Icbe6971727d684a266b12a0b41474397e536bfdc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Previously, starting a mouse drag outside a DragHandler's parent and
moving inside would activate it. This is unexpected behavior,
inconsistent with touch behavior, and might interfere with other drags,
so we only activate a DragHandler if at least one point was pressed
inside the parent.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-127863
Change-Id: I2215636397ce9fc6a29b9a35165507e5b8d886f4
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The tests show that the sslOptions property is out of sync with the
underlying QSslConfiguration.
Amends b44f466621.
Task-number: QTBUG-137900
Pick-to: 6.10 6.9 6.8
Change-Id: I2a34b373ea868c7e76c7470f872d3ba0233394ea
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The ExecutionEngine can live without a QQmlEngine or a QJSEngine, but
not vice versa. Therefore, the ExecutionEngine has to outlive QQmlEngine
and QJSEngine on shutdown.
Since the ExecutionEngine lives longer now, we also need to postpone the
pruning of the type registry. The engine might still hold on to types
after all.
Task-number: QTBUG-137848
Change-Id: Ib574cac84b5f2d974cbc24ed79550a58b69a7a1c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Account for top and bottom safe margins in Quick tests.
Pick-to: 6.10 6.9
Change-Id: Id1cb4486780f3fc42a96e2efb854d3700de619a0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A mere jump does not cause all value types and lists to be invalidated.
Only calls to other functions or writes to other properties do that.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137540
Change-Id: I069c6873455c51bbea59cf876d2bc7ecd188f81b
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Stack-created lists of primitives or pointers cannot be affected by side
effects. We cannot write a value affected by side effects to a list that
isn't, though.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: I99ab4337cabc6111a81b8164fd94962edc0db25e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
We use the JavaScript extension as "read" type to signify that the code
generator will accept any type with such an extension. This requires
some adjustments in the type resolver.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: Ia34ca0a24c417c5372852268ba2f55825484639d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This reveals an inconsistency: Instantiator retains any delegate of a
DelegateModel passed in as model and stores its own delegate separately.
Other views update the delegate of any DelegateModel passed in and do
not store their own delegates.
Task-number: QTBUG-132420
Change-Id: Ifa27170ea2ff47b5adeec7ac5a065839bdd1d143
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Remove the text and clear the text selection when the Ctrl+Backspace used on TextInput.
Fixes: QTBUG-81803
Pick-to: 6.9 6.10
Change-Id: I506b12714f13d2758f38e2366dbc898f570ea89f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Setting `interactive: false` on TableView is drastic (except perhaps in
some mode that the user can enter somehow), but setting
`acceptedButtons: Qt.NoButton` should be the default, to have flicking
on touchscreens but avoid dragging by mouse. This is possible since
cbc694491b (but the default was not
changed, for fear of surprising users with a behavior change).
So now QQuickSelectionRectanglePrivate::updateSelectionMode() allows
dragging in either case, via all devices if the TableView is not
interactive, or mouse-only if the flicking is touch-only.
Long-press has so far been allowed to select only in the case when
dragging cannot select. But if the TableView has interactive: true,
then you can flick it on a touchscreen, regardless of how
acceptedButtons is set, even though we may expect the user to select
dragging the mouse. So now if `selectionMode: Auto` is declared, and
touch flicking works, we allow the long-press to select, because
otherwise there would not be a way to make a selection on a touchscreen.
We should not consider `interactive: false` to be normal (unless the
developer finds a need to disable scrolling in some unique modal use
case that can be exited somehow). `acceptedButtons: Qt.LeftButton`
is not a very useful setting either (even though it's still the
default).
The snippet is improved to illustrate, along with some drive-by's.
Docs explain the behavior in more detail. Test coverage is added in the
manual test and the autotest.
Pick-to: 6.9 6.10
Task-number: QTBUG-97111
Task-number: QTBUG-132268
Change-Id: I912dbc7bf8de536794b5bdcc1269bf2860645de9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
These should already behave the same with much-older Qt versions:
so far, multi-point handlers require all points to be pressed inside the
parent Item.
Although DragHandler has long supported setting minimumPointCount to
require more than one finger, we didn't have test coverage for that.
So far the main "real" use case is the 2-finger tilt gesture in maps
(in which case target is null), but it can also be used for dragging
a target with more than one finger.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-127863
Change-Id: I2d4734f12a31a4b720bd11c05a61bc0cdc3b84ce
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Since de591d440c2f43a7e94ef4c93db757d254fa7947, we use [vMoved] to check
if it is the first move in dragging. However [vMoved] can be reset to
false during dragging, and this causes the content to jump back when
scrolling to the edge of the flickable.
(for example when pixel delta is zero, see the code in QQuickFlickable::wheelEvent)
And this issue became more obvious after ec4368adb7.
Since [vMoved] can now be reset to false in all boundsBehavior.
So we need to also check [vData.dragging] to make sure we are correctly in the first move.
Pick-to: 6.9 6.10
Fixes: QTBUG-137323
Change-Id: Ie2222e42c6628df62221ae8f63a55e7bf70d80f0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Emit signal cursorPositionChanged() whenever cursor position has
changed after a word is deleted.
Add an autotest.
Fixes: QTBUG-104829
Pick-to: 6.9 6.10
Change-Id: I174e97f5b320dfdddca8805fa807a8f323a0ef16
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QLibraryInfo was used, but the header was missing
Pick-to: 6.10
Change-Id: I141f7b5340b92df5bb757f2caed22b8375ee05e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
A new environment variable, "QV4_MM_CROSS_VALIDATE_INCREMENTAL_GC", is
introduced that turns on, when set, additional debug behavior in the GC.
In particular, when the mode is enabled and the GC is running in
incremental mode, after every mark phase, some additional validation will
be performed to catch some amount of issues that could be introduced by
the usage of the incremental garbage collector.
In more details, a snapshot of which object was marked by the
incremental run is stored, the mark phase of the GC is then run a second
time in a stop-the-world manner.
The result of the second phase is then compared to the original, making
sure that supposedly bug-induced discrepancies are logged.
Generally, any discrepancy should indicate something that has gone
wrong in one run or the other, possibly both independently.
Nonetheless, for this mode, we assume that non-incremental runs of the
GC can be considered to have a baseline correctness that can be used as
a verifier for the output of the mark phase of a GC run, and in
particular a run of the incremental mode of the GC.
A new state was added to the GC that is intended to run between the end
of the mark phase and the start of the sweep phase.
The implementation for the execution of the `markReady` state was
modified to traverse to this new state during an incremental run when
the relevant environment variable was set during the creation of a
`MemoryManager` instance.
The new state generally implements the algorithm described above.
In particular, a copy of the black bitmaps of each allocator, which are
the result of the mark phase and are enough to pinpoint which part of
the memory was marked, is stored away.
The relevant state that is hold by the GC, is reset to a state that
allows running the mark phase again.
The mark phase is then run from start to finish and the new state of the
black bitmaps of each allocator is compared to the one produced by the
latest run.
Errors are reported when we find that the incremental run has not marked
an object that was considered alive by the non-incremental run, that is,
that we are going to collect an object that is still alive.
Cases where the new run has found an object, that was considered to be
alive by an incremental-run, to be dead, are ignored.
This is due to the incremental run of a GC sometimes being unable to
directly identify an unreachable object as dead, for example when
allocations are performed at certain points in the incremental run.
The implementation of `Managed::className` was modified by extracting
the formatting part out so that it can be accessed as part of the newly
added error reporting.
Some documentation for the new environment variable with a brief and
generic description of the new mode was added to the "Configuring the
JavaScript Engine" documentation page, where similar GC-related
environment variables are documented.
A test was added to ensure that the specific case of discrepancies that
we are interested into are caught by enabling the validation mode.
To allow for the testing process itself to be performed by the
fictitious introduction of bugs of the class we intend to uncover, we
ensure that the entry of the new state in the relevant `GCState` enum
is positioned as if it was part of the sweep phase.
Normally, the state that performs the verification will need to redrain
the stack to take into account changes that can have occurred between
the last state and the start of the verification state, as otherwise
false positives could be introduced by the partial snapshot of the black
bitmaps.
Nonetheless, a redrain can and should re-observe some objects that could
have already been marked in precedence. When this is so, any object that
is unmarked fictitiously, could be marked back again, preventing the
test, which has to mutate the the state at the boundaries of the
computation, from correctly observing the process.
By ensuring that the validation step is performed as if "it was part of
the sweep phase", it will use, during a normal run, the general redrain
process that is commonly part of the execution loop (as performed by
`transition`), so that the embedding of the redrain in the validation
step itself can be avoided.
The test can then perform the necessary run of the GC without passing by
the normal execution loop, knowing that it controls when allocations are
performed, so that it can introduce the necessary mutations at the
boundaries without the risk of some of them being overwritten.
To simplify the testing process, and in particular to avoid having to
capture `qDebug` output during the test run, test-specific code that
saves an intermediate state that can be used as a witness of the
algorithm working correctly was added to the GC, behind the
"QT_BUILD_INTERNAL" flag.
Fixes: QTBUG-135064
Change-Id: If3f9ef029b51b77aaa5b68f349cbb1b20330be70
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Remove some unused code and allow it to run without QProcess. We can use
threads after all. Also, activate the "filter" mode via an environment
variable. Running only a subset of the tests is very handy at times.
Most of the dead code was supposed to be used with the qjstest
executable from d9c4a52724, but
d08ede57dd removed qjstest in favor of
using tst_ecmascripttests itself for all ways of running the tests.
Change-Id: I0d220964a98c3f49e97fc6650cf3169db5644af5
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
As mentioned in the comment, we cannot rely on the type registry for
property caches of inline components. So, whatever we find there is
necessarily outdated. Check the compilation unit's inline components
first to avoid this situation.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137115
Change-Id: I708435823428fd9f1cdae4b5bffda36d51ab1982
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We want the type loader to do this job rather than poorly duplicate it
in the test. In particular, the local implementation didn't properly
register the dependencies of loaded ECMAScript modules.
So far we could only load ECMAScript modules using the type loader if
their file names ended it ".mjs". The ECMAScript test suite does not
follow this convention. In order to deal with that, we need to add a
second characteristic. ECMAScript modules can now also be marked using a
URL fragment "#module". Furthermore, since JavaScript files loaded
outside any QML document get full access to the global context, we
introduce another URL fragment "#global" to discern them from the same
files loaded from a QML document.
Change-Id: I625088335d16d5b8eeaa2673f07718367dca1605
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
QQuickFolderListModel::beginResetModel calls endResetModel
automatically to avoid consequtive calls to beginResetModel.
However, the same logic is not done for endResetModell. This
triggers a endResetModel without a preceeding beginResetModel
which (apparently) causes problems with updating the view
contents in some cases.
Fixes: QTBUG-134600
Pick-to: 6.8 6.9 6.10
Change-Id: I9fe3034b784d83ee2ed5b65bdad3a77545891bc2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
tst_QQuickOverlay::pressedAndReleased is flaky on openSuSE where the
un-updated position of the window is used when the pressedSpy and
releasedSpy are called.
Use helper function ensurePositionTopLeft to give a fix position to
the window and verify that it has been updated.
Pick-to: 6.10 6.9
Fixes: QTBUG-134704
Change-Id: Ibec9f6f2857220d174744f80a11fc7552c1f2ece
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Set the FramelessWindowHint flag to tst_mouseAreaInterop::createview.
Removes flakiness from
tst_mouseAreaInterop::dragHandlerInSiblingGrabFromMouseAreaViaMouse.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I2cdbc9701a9e463bcf0a5f326df5726deb8fa093
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
tst_touchMouse::touchButtonOnFlickable is no longer flaky on openSUSE
leap.
Change-Id: I28d25150aabfa938507c1c2750d73cd159b7038c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
tst_touchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne is no longer
flaky on openSuSE 15.5.
Fixes: QTBUG-118059
Pick-to: 6.10
Change-Id: Ic1a0c89ee60336cbef677e2c065114ef38911fc7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The _qt_internal_write_deferred_qmlls_build_ini_file function is
deferred to be called in the root CMAKE_BINARY_DIR, where
QT_CMAKE_EXPORT_NAMESPACE is not defined if find_package(Qt6) is not
called in the root of the project (like in the Qt Creator super repo).
Make sure to pass the value of QT_CMAKE_EXPORT_NAMESPACE to the
function explicitly, from a scope where it is available.
This avoids errors like:
Error evaluating generator expression $
No target "::qtpaths"
CMakeLists.txt:DEFERRED
Add a test case to the RunCMake.qt_target_qml_sources test to ensure
this doesn't regress.
Amends ddcafa0a51
Augments 9b9a2398f30b6c35ef6be3ce929c352afb682910
Pick-to: 6.10
Fixes: QTBUG-137577
Change-Id: I5b70822576a4f26f24c37c0a866b97cb57150291
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The documentation for e.g. Row says:
If an item within a Row is not visible, or if it has a width or
height of 0, the item will not be laid out and it will not be
visible within the row.
Before this patch, the item wouldn't actually be hidden if its width
or height was zero, but just moved into a list of unpositioned items
and treated as if it was.
This patch fixes that by culling the item.
Fix and add rows to tst_qquickcontainer::zeroSize, which would
otherwise fail.
Fixes: QTBUG-132607
Pick-to: 6.8 6.9 6.10
Change-Id: I04c8a3f1ffb9e4a649024087626c4d7846ca01a0
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
... rather than QQmlEngine. This paves the way for having the type
loader attached to ExecutionEngine rather than QQmlEngine.
Also, reference the execution engine in the type loader, in turn.
Task-number: QTBUG-19407
Change-Id: I04e571c5c6ac5bce5e82537cb96c6940c7186f3a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In many cases, we were passing a fresh scope to the QQmlJSImportVisitor
as the target.
Add a new constructor whih takes care of this, and use it wherever
possilbe. This allows disambiguating between call-sites that update an
existing scope, and those which will create a new one.
Change-Id: I140c349ac2f17371b7916d38225170420053a718
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
CommitToBase was modifying the QDeferredFactory to point to the base
environment instead of the temporary child environment. This can lead to
weird behaviors in case the import paths in the temporary environment
were differing from the ones in the base environment.
Therefore, pass the import paths along to allow loading the file in the
base environment using the import paths of the temporary environment.
This avoid mishaps where lazy Qml files populated after their
commitToBase calls use a different import path than if they were
populated before their commitToBase calls.
This commit is a workaround for qmlls loading files that require
different import paths into the same DomEnvironment.
A proper fix should come with QTBUG-134308: qmlls should load
files that require different import paths into different
DomEnvironments/QQmlCodeModels. QTBUG-134308 seems to introduce too
much new code to be picked back and will take some time to be ready,
therefore this workaround.
Fixes: QTBUG-137705
Pick-to: 6.10 6.9 6.8
Change-Id: I9ddcc73558778d373a5de23c4fe90ec98bc99af3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Implement support for QAccessible::Attribute::Locale
(newly introduced in a previous qtbase commit) for
QQuickControl objects by introducing a new
QAccessibleQuickControl class that subclasses
QAccessibleQuickItem and implements
QAccessibleAttributesInterface to handle that
one attribute.
Add a corresponding unit test.
Pick-to: 6.10
Task-number: QTBUG-137144
Change-Id: I3d94df920d5c965d6d803512e8e37234be79a8fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is a handy way to torture test the type registry. Also, you can
attach a debugger to the tests without gymnastics this way.
Change-Id: I6b6e273d2b640ad28c22714b3aea9a9833b92917
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Blacklist it on opensuse and skip it on android.
Task-number: QTBUG-137400
Change-Id: I8da8352e210d80734f5b0f9b3ab4e43799dda84d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Before:
Cannot assign object to list property "animations"
After:
Cannot assign object of type "QQuickFrameAnimation" to list property "animations"; expected "QQuickAbstractAnimation*"
Fixes: QTBUG-137469
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Iddf52d4262720236ffc610b6f7326bb126c53509
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Initial implementation was based on the 3rd edition of ECMAScript.
Many things have changed since then and most of keywords were removed
from that section, even starting from the 5th edition of the standard.
This commit removes most of these reserved keywords, while leaving out
some which might potentially be useful for QML in the future.
Change-Id: I0190a6ea6d08b5d0797eb46c6636ffdb295b4565
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
If accessibility feature is disabled, also don't build the related tests.
Pick-to: 6.8 6.9 6.10
Change-Id: Ieb34b481f8638a484d1b1b0672b7047d3c6ea3fb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
We need to tell the type loader that this is an ECMAScript module since
it cannot determine it from the file name.
Amends commit dc60c305a2
Pick-to: 6.10 6.9 6.8
Change-Id: Ie91bce86a08a81ff3df6c11d016308e3e380f15f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Besides the named constants and (A)RGB representations,
QColor::fromString (which is used to parse valid strings) also supports
using "transparent". The linter however did not handle this special case
so far.
This commit adds the missing support. We don't add "transparent" to the
list of known color names to mirror the documentation in
QColor::fromString: "transparent" is not actually a color keyword, but a
separate check.
Amends 53ccd32136
Fixes: QTBUG-137054
Change-Id: Ic031144b888d3fa892a87c44b4bffdc4c21bebf8
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This adapts to 7bd7df5aa170c240061144a9210a13b62949935c.
The test was expecting e.g. this path:
/var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir
But the actual path was this:
/private/var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir
Fixes: QTBUG-137416
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I31b929017ebb1a672a614f8b409dc5c4e8d5e000
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QQmlData is attached to a QObject, and consequently can't be used to
track engine local state. Whether a _given_ engine has a const wrapper
for a QObject is an example of such local state.
False assumptions based on hasConstWrapper in turn led to asserts when
using multiple engines.
Fix this by changing the meaning of hasConstWrapper: It now only
indicates that at some point, a given engine had created a const
wrapper. If that flag is not set, we know that we can skip lookups in
m_multiplyWrappedQObjects. If it is set, we can't assume anything, and
have to consult our engines m_multiplyWrappedQObjects to truly know
whether we have a const wrapper or not.
Pick-to: 6.10 6.9 6.8
Change-Id: Id26823bdc942b227c991571334f45f45b8b109c3
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This patch addresses flaky failures in the context menu keyboard test
on xcb platforms. Previously, after opening the menu, the menu was
sometimes not opened as expected. Additionally, simulating a Tab key
press after opening the menu did not always give focus to the first
menu item.
The root cause was the focus timing inconsistencies on xcb: when the
window is shown, it may not receive focus immediately. This can
deactivate the application's focus window, causing popups/menus to
close unexpectedly or preventing the Tab key from correctly focusing
the first menu item.
To fix this, the patch processes pending and deferred events before
opening the menu, but only on xcb platforms, ensuring the window
receives focus in time.
Pick-to: 6.10
Task-number: QTBUG-133858
Change-Id: I648c72b484852d23c84e41dc6450c1f50cc4bdc2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Until we support a proper representation of enums in the type system,
all we can do is warn the user that enums can't be used as types.
After the improved runtime warning added in a recent commit, this patch
adds a qmllint warning to warn about the same issue but at
'compile time'.
Fixes: QTBUG-135255
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I02266f21266e59eb6d4a4dbe0e4335b845c62133
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
The warning emitted when calling functions with parameters type
annotated with enums does not communicate what's wrong or how to fix
it:
"1 should be coerced to void because the function called is
insufficiently annotated. The original value is retained. This will
change in a future version of Qt."
Until we support a proper representation of enums in the type system,
all we can do is warn the user that this does not work.
Add another warning that fires once when the function is constructed
that has a better description of what is going wrong. This should
provide the user with the info to solve the issue unlike the original
warning.
This does mean that we warn more for the same issue but it should still
be beneficial overall.
Task-number: QTBUG-135255
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Icd8f8d80c6a4b9bd2b33c660394b9cf5a228a346
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Ths logic of deciding if we need to grab a gesture was using
scenePosition() and scenePressPosition() and comparing the diff to the
styleHints()->startDragDistance().
If the scene is scaled, the returned points are also scaled, but the
startDragDistance() value is not affected by the scale. As a result,
the logic for grabbing the gesture was broken, starting it too early
(if scale > 1.0), or too late (if scale < 1.0).
Fix it by calling mapFromScene() on both points.
Fixes: QTBUG-131886
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie7c7472f9d9806d18728b4059e23ec279090db6f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This is what users would expect, as it's how Qt Quick behaves in
general.
Fixes: QTBUG-133924
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I2af6d48f5fa6fb15ee93efe1eac0ae950872834e
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
We can't store them as QObject because that may result in dangling
pointers. We need the heap wrappers to track deletions.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-135295
Change-Id: Id53932aec834ad59104bd867c0056fb8da94d827
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
qmlcachegen can't resolve all types when importing QtQuick.Controls, so
scopes from QtQuick.Controls might be unresolved.
Check the scope before creating a fix suggesion when checking the
required properties, and add a test that tests a file with required
properties on an unresolved base type "Tumbler".
This also fixes the crashes from QTBUG-137196 and QTBUG-136998 it seems.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137411
Fixes: QTBUG-137196
Fixes: QTBUG-136998
Change-Id: Ibf461b54abf84ba13bff8c4833940c7359cf2d8e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The pointer returned by ensureCommentForNode() is invalidated when the
m_commentedElements map is modified, for example when inserting a new
comment via another ensureCommentForNode().
In the StatementList, we actually don't need to create a comment, we
just need to lookup one comment, so partially revert the apparently
drive-by change from b91ca3e0bc.
A separate commit will make ensureCommentForNode() private to avoid
similar crashes in the future.
Fixes: QTBUG-137413
Pick-to: 6.8 6.9 6.10
Change-Id: I6e281cc155e2179a880fa4a876133d90c4afae75
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This allows a type A to have a property of type B while B also has
a property of type A. This is very helpful for list-like or otherwise
linked data structures. For example the BaseConstraint type in the
DeltaBlue benchmark wouldn't have been necessary if this feature had
been available before.
It has the side effect of making it impossible to validate inline
component types before they're instantiated. We don't actually have
the type at the point where a property is declared. However, since
you certainly want to instantiate at some point and qmllint will still
help you find the problem, this is acceptable.
We also have to intercept URLs before we create QQmlType instances now.
This is because now we only have the URLs to identify types. Having
multiple QQmlType instances referring to the same logical type wsd a bad
idea anyway.
[ChangeLog][QtQml] You can now have cyclic type references in QML
documents. A QML type A can have a property of type B while B has a
property of type A. You can still not cyclically inherit or
instantiate types in QML documents, of course
[ChangeLog][QtQml] Your URL interceptors may get called more often now,
for URLs QML neglected to intercept before. This means that more URLs
may be constructed from already-intercepted base URLs. URL interceptors
should check for this condition.
Change-Id: I84753a883c2de98e16d1c3826e7e56e897eeafb8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
When TableView needs to resolve if a model item is editable, it needs
to call QAbstractItemModel::flags(modelIndex). But as it stood, it would
call this function on the internal proxy model set by TreeModel, using a
QModelIndex from the application model (tappedIndex).
Since tappedIndex belongs to the application model, this patch
makes sure that we ask the application model, and not the proxy
model, if the given model item is editable.
Fixes: QTBUG-136492
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0011c46f1b07470ebcb83d93aa3d592e7339345e
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
QColor::fromString does not care about the casing of named colors, and
conseqently neither does the QML engine. Unconditionally lower case the
color in the check to accomadate it.
Pick-to: 6.10
Change-Id: I35aa4162bcd8682bbea86776c9929e00f891cdb9
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Make members private, add accessors, add m_ to member names, etc.
Change-Id: I497db10b62bbfb32f55dca227af9a518da6eaa70
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Normalize near-zero values to 0.0 first before doing a fuzzy compare,
as the latter may give false when comparing near-zero values to 0 eg:
0.0 and 1e-15.
Fixes: QTBUG-134635
Pick-to: 6.8 6.9 6.10
Done-with: Jasuhan-Yoganathan <yasuhan.yoganathan@qt.io>
Change-Id: I81474760dded319d41280c3ef8dbff340ae649e3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The second column refers to "age" which is supposed to be an int,
not a string.
Pick-to: 6.10 6.9 6.8
Change-Id: Ie21e9efa89b541e5b58ff9450c12dd66fe1c6700
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The hover event delivery logic is based on scenePosition, so the global
position has to be calculated. Using item.mapToGlobal(scenePosition)
will apply the item's position twice. This change first calculates
localPosition and then uses item.mapToGlobal(localPosition).
Fixes: QTBUG-134099
Pick-to: 6.10 6.9 6.8
Change-Id: I83f1382784300a1c73ab2b6f50e0288dcf99689b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
In the affeted row in the patch, it should be QQuickTableView::AnyKeyPressed,
and not QQuickTableView::EditKeyPressed.
Change-Id: Ib8493bbfbdf0528b740974c3a5f2f1c22371ac9f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Add a .qt/.qmlls.build.ini file into the top-level build folder that
maps locations of QML modules to their import paths.
This avoids generating .qmlls.build.ini files in all QML modules build
folder and only generates one file.
This will allow qmlls to know the extra import paths set via "IMPORTS
TARGET" and "DEPENDENCIES TARGET" in CMake just by knowing the build
folder, so that the import paths don't need to be passed by the editor
or .qmlls.ini to qmlls. A separate commit will take care of making qmlls
read the .qmlls.build.ini file.
This could be extended in the future if we realize that qmlls needs more
information from the build system.
Add a test.
Task-number: QTBUG-134307
Change-Id: Ic10fb6088894e13388a96bc4922048fa7bb89d6b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When searching for inline components, we perform a BFS starting from a
type and recursing into its base types and children. We previously
didn't check the scope type of the children. This is wasteful as there
is no point in recursing into scopes such as enum or script scopes.
This also has the side effect of fixing an infinite loop in certain
cases where a grouped property's base type is one of its parents. That
type would then get readded to the list of to-be-visited nodes over and
over. The question of the base type of the grouped property will need to
be dealt with in another commit. Created QTBUG-137327.
Amends bfdf1bf797
Fixes: QTBUG-137035
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic56087e2cb5ffd33b4659b411ad8954a4c15e0fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is the result of running util/normalize on the code base. The
following manual edits were needed:
(none)
Pick-to: 6.10 6.9
Change-Id: I222460afe00375733f2e5064d0dcbe51d58cdf7f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We were missing the DECLARE_MARKOBJECTS macro, which could lead to heap
corruption if the mapping was actually in use.
Pick-to: 6.10 6.9
Fixes: QTBUG-137350
Change-Id: Idd9184a3a3c35faa7caf35d0e3ac8c901f99afb7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
[ChangeLog][iOS] The iOS style now enables expanded client areas by
default. To override this, set the ApplicationWindow's flags explicitly
to e.g. Qt.Window.
Change-Id: I333e36d2959b2ff8029cc685ec2b5610d11e6069
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
When creating the QQmlJSScopes for enums, we would not resolve their
corresponding list type, leading to confused qmllint warnings about the
type not being found.
Fix this by immediately creating the corresponding list type when an
enum tpye is created.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137256
Change-Id: Ic0479b19467820838426a6f6fe5288cad62e3ff7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add a new QQuickSearchField as part of the Qt Quick Controls to
simplify implementing search functionality for lists of items.
Task-number: QTBUG-126188
Change-Id: I634131161447616a2d66e7f301bd8a24adac2d7f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Now that Android takes safe area margins into account on startup,
as of qtbase e96a4b84e136d065054600c07bf5fae17f3049ce, we can't
assume the size of elements placed into the content item is the
same size as the screen's available size.
What these tests seem to test is that the root elements of a
window fill the available space in the window correctly, which
we can check by comparing the size to that of the content item,
which is automatically inset based on the window's safe area
margins.
Pick-to: 6.9
Fixes: QTBUG-137285
Change-Id: I6f40ba824426f0acec73e50cdc9984c05a44bf91
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
As documented, the Window attached property only works with item derived
types. The attached object is however still created, so there is no
runtime failure. Print a warning message to give the developer a hint
about it.
Task-number: QTBUG-134800
Pick-to: 6.9 6.8
Change-Id: I359e665c2add5a80e9f986f96f90176d93cfc865
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
[ChangeLog][QML] It is now possible to map between the value of enum
keys and their string representations by calling the enumStringToValue,
enumValueToString, and enumValueToStrings methods on the Qt global
object.
// Main.qml
Item {
enum E { Black = 0, White = 1, Grey = 2, Gray = 2 }
// 1 (White)
property int i: Qt.enumStringToValue(Main.E, "White")
// "Black"
property string s: Qt.enumValueToString(Main.E, Main.E.Black)
// ["Grey", "Gray"]
property list<string> ss: Qt.enumValueToStrings(Main.E, Main.E.Grey)
}
Fixes: QTBUG-116513
Change-Id: I78d9cdcfb2761e0cf4b22f2402701a0972686eb2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
[ChangeLog][QML] It is now possible to access unscoped enum values in a
scoped way as <component name>.<enum name>.<key>. Previously, it was
only possible to access them in an unscoped way.
Task-number: QTBUG-116513
Change-Id: Iff56cd3365516215e1e195a147fae66ee17d39e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Massage the test to become a data test, so that it can be more easily
extended and changed.
Change-Id: I7eca260b9ba4b73fd4d474ed18ebd0bed46afb5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Warn in qmllint when encountering "==" or "!=" about possible type
coercions between JS objects, numbers, strings and booleans.
Task-number: QTBUG-129307
Change-Id: Ib9b8057c1b4eca760c4f40825f4053aa35f1680b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Find and read the import paths and documentation directory from the
.qmlls.build.ini file in qmlls.
Add a test.
Fixes: QTBUG-134307
Change-Id: I0a61bc7fa7ce1fec63165419883d62601cf5b286
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If a property binding is a js block without any statements, it could
mean that the user intended to create an object literal instead of an
empty block that returns undefined.
Task-number: QTBUG-129307
Change-Id: If242ddac140cce6479062194b785096ba1f6c0a6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously in 01de987039 we allowed
MousePress and MouseRelease events to be passed to non-popup children of
the overlay, but no other pointer event types.
Allowing just MousePress and MouseRelease events seems arbitrary, since
we should either tell users that they can put items on top of the
overlay, or discourage this kind of use case altogether.
Since 81e53a7e9c we documented that this
is a practice that should work normally, and thus it would make sense to
allow all types of events to be sent to items that are on top of the
overlay.
Fixes: QTBUG-132644
Task-number: QTBUG-134545
Pick-to: 6.9 6.8 6.5
Change-Id: Iad29b9abb694bd0653da220f2922b294219396bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
A test was slightly adapted as a result.
Task-number: QTBUG-129307
Change-Id: I07ac61b183d9d7d237e9cf51ce3a0c6c280daa45
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Two other tests needed to be updated as a result.
Task-number: QTBUG-129307
Change-Id: I1470a5ae93cc20ef90ffd63471bd36408b61af57
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Append a subtree to an empty model. The first input is not verified,
but subsequent appends are validated against this first input.
Task-number: QTBUG-130571
Change-Id: I7ea3b327ef2ad392dbff32c2277d95817e183066
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Enhance QSortFilterProxyModel to be available in QML with changes
as mentioned below and export the type as SortFilterProxyModel
(Note: adopted most of these features from existing project -
https://github.com/oKcerG/SortFilterProxyModel)
* Inherit QQmlSortFilterProxyModelPrivate from
QSortFilterProxyModelHelper and use the mapping logic
of source to proxy indexes from it.
* Allow the model to be configurable with multiple filters and
sorters. The filter and sorter components shall be inherited
from QQmlFilterBase and QQmlSorterBase respectively.
The components are maintained within the respective compositor
classes. The filter and sorting operation from
QQmlSortFilterProxyModel will be forwarded to the compositor
which then iterate through the configured components to sieve
the data. This patch allows the following filters and sorters
configurable in SFPM,
Filters:
ValueFilter - Filters the data that matching with the
provided value or role name or combined
together if both are specified.
FunctionFilter - Filters the data according to the result
of the evaluated js method.
Sorters:
RoleSorter - Sorts the data according to the provided
role name.
StringSorter - Sorts the data by considering the locale.
FunctionSorter - Sorts the data according to the evaluated
js method.
* Add support for 'enabled', 'column' property for both filters
and sorters, and 'priority' property for the sorters.
Task-number: QTBUG-71348
Change-Id: I65b84936642e5f0f382d83413648d2c6794c18aa
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Also try some invalid indices and values.
Task-number: QTBUG-130571
Change-Id: Ie24561a1e4fc1162d750f6690b307a6b8482493c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Try to append to invalid indices and some malformed data as well.
Task-number: QTBUG-130571
Change-Id: I5aa7d5f93f8f69e953ac398aa2d84e55dc7a3f68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Try to add a node, a subtree and some invalid values.
Task-number: QTBUG-130571
Change-Id: Ibe3d0d9f59386fc6c5e2f8ac85420e54b4da707f
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Clear should erase all the rows but the column data should remain
unchanged.
Task-number: QTBUG-130571
Change-Id: I436538173f14bfa4c3315483176a3ebcb8322317
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Test for both valid and invalid indices.
Task-number: QTBUG-130571
Change-Id: Id79e7877c0d59cd75bace57c95efa16f2da7b605
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>