We want them alphabetically sorted so that we minimize merge conflicts.
Change-Id: If6509fb1d196a10898fd6d9a5f51a9da678ad3c9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In order to choose the right file-selected components and scripts when
resolving types we need to drop all but the "base" ones from the qmldir.
This has to be done right after parsing the qmldir, but only at run
time. At compile time we need the extra information to determine that we
cannot compile any access to such files to C++.
Pick-to: 6.5 6.6
Fixes: QTBUG-113940
Change-Id: I734b865202b6241d5dd60c134214bdbe09ea10f4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Remove custom implementations found in qqmljs* and use the
static helper methods from qqmlsignalnames_p.h instead. This sometimes
requires to move some code around to avoid bugs with property that do
not have letters in their name.
Add a warning in the JS implementation of the SignalSpy.qml that the
used heuristic might fail on certain signal names.
Add tests in in tst_qqmllanguage to see if the property change handlers
work correctly for weird names.
Change-Id: I4dc73c34df7f77f529511fa04ab5fcc5385b59fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Try to follow the QRhiWidget API in most ways.
Implies that the rhitextureitem example is repurposed
to be the QQuickRhiItem example.
The qquickitemrhiintegration autotest is repurposed as
the qquickrhiitem autotest.
Task-number: QTBUG-113331
Change-Id: I045d87f82ace07c8571c72c78e193cd5201cad69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
qmlformat was erroneously adding an extra space in target bindings like
"Behavior on opacity {". The extra space is removed, and the tests are
updated to prevent regression for this behavior.
Fixes: QTBUG-114801
Pick-to: 6.5 6.6
Change-Id: I79f563e40c75a325ab13f1fbffd73daa71fe1ec9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
If we mess up the sorting we may not be able to find types afterwards.
Unfortunately we sometimes realize that extra types have to be added
during the analysis.
Pick-to: 6.6
Change-Id: I80617c5c55383fa1e884bdf4182c79b10581467e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We need to accept the sequence value type even if we cannot find it in
the type descriptions. It may be a builtin after all. Once we have
structured information on our builtins, we can drop this again.
Amends commit ad88383b46.
Pick-to: 6.6
Change-Id: I52cd6fac0c5e73c2509f5848284e9cad91781abb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Implement the checking of user-supplied names for renaming operations
in QmlLSUtils and qqmlrenamesymbolsupport.cpp
Add a helper method QQmlLSUtils::isValidEcmaScriptIdentifier that runs
the lexer on an identifier. Reject identifiers that do not parse as
T_IDENTIFIER, like keywords and invalid unicode escapes, for example.
Extend QQmlLSUtilsExpressionType to contain the name of the current
object.
Drive-by change: fix a off-by-one bug in the lexer, where files (or
identifiers, in this case) could not be lexed when they were ending with
an unicode-sequence.
Also, do not crash on JSIdentifiers without semantic scope in
resolveIdentifierExpressionType.
Add some tests, and fix a warning about positionAfterOneIndent
not being used in tst_qmlls_modules.cpp.
Add QQmlLSUtils::isChangedSignalName next to
QQmlLSUtils::isChangedHandlerName, and QQmlLSUtils::isHandlerName
and add tests for all three.
Fixes: QTBUG-114951
Task-number: QTBUG-114788
Change-Id: I0f1a544b70dfb69bca4aef355a8a8658f1d23081
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The popup behavior is inconsistent when its moved or repositioned over
the edges of the bounding window. This happens for negative margins,
as its made to bound within the window (while respositioning using
QQuickPopupPositioner::reposition) only on left and top edges of
the window during resize, but its allowed to move outside the bounding
window on right and bottom edges. This pushing of popup within the bound
can also sometimes leads to infinite polish issues (for the qml
configuration as mentioned in the bug report QTBUG-107473).
This patch set removes this constraints for popup to move beyond edges of
the window (through QQuickPopupPrivate::relaxEdgeConstraint) during
resize. By default, this flag is disabled, means those controls which
inherits from popup restricts by itself not to move beyond the edges
during resize.
[ChangeLog][Qt Quick Controls][Popup][Important Behavior Changes] The popup
default margins (-1) earlier was constrained on left and top edges, but
allowed to move beyond right and bottom edges. The behavior changed now to
relax this constraint and move beyond all edges. Also to be noted, edge
constraints has been relaxed only for Popup and controls inheriting from
popup (such as drawer, menu) still follows earlier behavior.
Fixes: QTBUG-107473
Fixes: QTBUG-77647
Change-Id: Icf0dc909559b5059a7371a6455a15ffc84e9b77d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
7a5bbc2315 repositioned items upon
startup, but didn't account for items added afterwards. Do that here
so that semi-transparent pages don't show pages beneath them.
Fixes: QTBUG-115468
Pick-to: 6.2 6.5 6.6
Change-Id: If5ca587a6c14ddae5108c0a45d13fa2d290d1865
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Taking the translucentPages component from
SwipeView::test_initialPositions into a Qt Quick app and running it
showed that the Text items weren't actually filling the SwipeView. The
documentation states:
"SwipeView is populated with a set of pages. One page is visible at a
time."
The implication here being that each item fills the SwipeView, hence only
one being visible at a time.
It also states that SwipeView manages the geometry of items:
"Note: SwipeView takes over the geometry management of items added to
the view. Using anchors on the items is not supported, and any width or
height assignment will be overridden by the view. Notice that this only
applies to the root of the item. Specifying width and height, or using
anchors for its children works as expected."
So, this patch corrects the behavior and updates the test.
Pick-to: 6.2 6.5 6.6
Change-Id: I3425d4d028743f440f003e86ba009a2da7cca9cb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It got accidentally disabled during the qmake to cmake transition.
Change-Id: I27723a231e0a616f3b8de3db0fbe9a16fefac914
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When you use qmlls's 'go to definition' on an id, it jumps to the
object around it, instead of the id-binding. For example:
```
Item { id:me }
// go to definition for 'me' goes to 'Item' above instead of the 'me'
// after the id!
function f() { console.log(me)}
```
Retrieve the correct sourcelocation from the Dom, fix the tests,
and remove one unused helper method in tst_qmlls_modules.
Change-Id: Ic25ceb8399cbc27e65574f2c3c7e71249bcac8f6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Various tests dereferenced the QTextObject * of a create()'s return
without first checking that's not a crash. In one case, there was a
null-check, but someone had added a new dereference before it.
Change-Id: I358571c20c6a6f22b32f5ecdc9dade25b51545ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It gives a more informative report than QVERIFY() would.
Change-Id: I3accda8bdd807175b234d0aa9bd553825b883e6e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Setting the same header repeatedly appends values to the header, as
the test-cases' expected output indeed shows, so don't claim the last
setting over-writes all earlier ones. Reflow in the process.
Change-Id: Ib21d218e5f762c3842aa03d380ed795023e5434d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
None of these tests care about Accept-Language, which
QHttpNetworkConnection sets automatically based on the system locale,
so testing for it (by including a line for it in .expect files),
setting it and skipping tests due to its "locale-dependence" were all
unnecessary. Just tell the test-server to {{Ignore}} the value of the
header.
This failed on Android due to one of the data files being unavailable,
so make access to that a precondition of its test.
Pick-to: 6.5 6.6
Change-Id: I560ead8b3ace6a5df173d96aea10f8dac3ed1124
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The overlay filters wheel event for the popup item as part of patch set
caca7d7d4f. These events are consumed by
modal popup when the top level item is not its child. In a case, where
top level item is a child of overlay and stacked higher than popup, the
wheel event should be delivered to the top level item.
This patch set validates item at the top is child of overlay or popup
item and deliver wheel events accordingly.
Fixes: QTBUG-113842
Pick-to: 6.6 6.5
Change-Id: I2d27c09738742ef5ae25e42eca3747f1631baa6c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
There's no harm in customizing these, and especially the contentItem
and footer need to be customizable, as that's where the content and
any customized OK/Cancel/etc. buttons go.
This fixes warnings in the testbench manual test.
Currently only the macOS styles has implementations of these
controls.
Pick-to: 6.5 6.6
Change-Id: I09678c777088786961583724d68dc2c3f6d90895
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Since QByteArray is sequentially iterable and we allow any sequentially
iterable type to be constructed from a JS array, we also need to allow
this.
Pick-to: 6.6 6.5
Fixes: QTBUG-115733
Change-Id: I6ffd5eaad0e587ea1cafbe0c1b0179202f3f28cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Qmlls is very slow when showing lint suggestions while writing code,
sometimes it does not even show lint suggestions (you need to enter some
characters until they appear, and lint suggestions disappear while
writing completely unrelated code.
Change the "waiting for new keystrokes when finding an invalid document"
delay from 4000ms to 400ms to display lint errors as soon as the users
stops typing.
Overall, the logic to choose the current version to show lint warnings
on is buggy and unreadable, so it was rewritten into the helper
methods "chooseVersionToDiagnoseHelper" and
"chooseVersionToDiagnoseHelper".
The old implementation of chooseVersionToDiagnose would sometimes pick
no version to be diagnosed for invalid documents, and then the code
would send a message to the client claiming "no errors found" (because
no diagnostic was executed). This is the cause for the lint suggestions
sometimes disappearing when writing unrelated code, and sometimes
shortly reappearing during certain keystrokes.
The new implementation checks for
* was current version already diagnosed? skip
* is current version valid? diagnose
* is current version invalid and recent ? wait for more keystrokes in
case user is typing
* is current version invalid and older than 400ms? diagnose
Extract the two lambdas "addLength" and "messageToDiagnostic" into their
own static methods, and make sure no diagnostic results are published
when no diagnostics were executed.
Also, add tests that allow to simulate the user typing some code.
Pick-to: 6.5 6.6
Change-Id: I9c8300e7d1b4f9b10e576ece983d927535a7e4a8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When searching for a definition or a usage of a property, qmlls was
reporting the entire property definition (property int i: 123) instead
of just the identifier. Return just the location of the identifier 'i'
instead and fix the tests that expects the old behavior.
Change-Id: I47cc3aba92ce15d9036dc1772bdd9ed4d537c884
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Give the outer QtObject an id so we can overtly access its status.
Change-Id: Iffe68b85cc43d2bedf046dc40d6c6cae34569072
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If we are procedurally setting a shadowable property, the read register
for the value will be converted to var. We can therefore not just
retrieve the property type again in the code generator to determine what
we have to do.
What we actually need is the information on the original scope type of
the lookup. We need to know what exactly the base type was supposed to
be. To that effect, store the scope of the target for each conversion in
QQmlJSRegisterContent.
We need to circumvent the questionable optimization of "deduplicating"
functions that certain compilers exhibit, like we do for the getters.
Pick-to: 6.6
Fixes: QTBUG-115526
Change-Id: I361f2e46e39ece7892df72ae13ec756f9aec4adf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The common theme amongst these is that this author detected in split
seconds that fixing the loop was easier than performing the #undef
QT_NO_FOREACH dance.
Naturally, all these fall into the category "loop over (readily made)
const local variables", which cannot possibly require the safety copy
that Q_FOREACH unconditionally performs.
Pick-to: 6.6 6.5
Task-number: QTBUG-115808
Change-Id: I652562711ae43e8bb36493ea990114d91c5b7d5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The class owns a list of children via a QVector<Node*>, so copying a
Node would cause two Nodes to own the same children. So, go the extra
mile and use Q_DISABLE_COPY_MOVE(). Also shuts up Clazy.
Pick-to: 6.6
Change-Id: Ie225d4cd30e859f2a91cce36bc0a43be23b3b4e5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Replace the foreach loop with a call to qDeleteAll().
This is required, in the grand scheme of things, because the code is
in a header, and that makes any TU including it (all, in case of PCH)
incompatible with QT_NO_FOREACH.
This is also safe, however, because a) Node is non-polymorphic and b)
the Node destructor (the function containing the loop!) doesn't
attempt to unregister from its parent, so we know exactly what code is
being run here, and it's not modifying the container.
Task-number: QTBUG-115808
Change-Id: I5e434d55945fa36b318427a4ea528ac4991422c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It is only used by a test (which doesn't test any other functionality
besides that we get the correct qualified name).
QQmlJSImporter::setQualifiedNamesOn keeps its current name, but probably
should be renamed.
Change-Id: Ie36c342943b545be0de7bba53a2fbd6c6f0adc0d
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
ContextualTypes are required in the import visitor logic, but they
aren't actually used directly inside QQmlJSScope.
Change-Id: I5cd49076687ef97c1077678c8dc757cde3b94c51
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
This commit does not add any new functionality but refactors the code in
qmllsutils to be ready for the "check if names are valid during a
rename" feature of renaming usages in qmlls.
Encapsulate the result of resolveExpressionType into its own struct.
Like this, resolveExpressionType can return additional information like
the type of identifier (a signal, a signal handler, ...) that was
resolved. Adapt the code using resolveExpressionType to use the new struct.
Rename namingAlternativesOf to resolveNameInQmlScope, as it actually
does resolve a name to whatever it represents in a QML scope (a
property, a property changed handler, a signal, and so on).
Rename findMethodIn and findPropertyIn to methodFromReferrerScope and
propertyFromReferrerScope to differentiate between the method
"hasMethodOrSignal" that "finds a method/property inside one QML scope"
and "methodFromReferrerScope" that "finds a method/property one can
call/use from the given scope that may belong to another QML Object".
Move some code from resolveExpressionType into its own static method
resolveIdentifierExpressionType. Also remove some code duplication from
resolveExpressionType and dead code (e.g. the QQmlLSUtilsResolveOptions
is only required when working on identifier expressions for qualified
names and properties).
Change-Id: I313711015675c23b53bb426a7124b8f4b57f4545
Task-number: QTBUG-114788
Task-number: QTBUG-114951
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add a qmlls module for renaming symbols, and start implementing the
rename operation in qmllsutils.
ToDos for later commits:
* sanitize the new name obtained from the user and warn if invalid. Also
warn if current symbol cannot be renamed (because it is defined
in another module or in a cpp file for example).
* support renaming Qml Components (including changing the qml file name
defining the component) (requires implementing finding usages of Qml
Components first)
Task-number: QTBUG-114788
Fixes: QTBUG-114948
Change-Id: I045949bd3a83c32fcb50ffb718c5a63e1f002c0c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The function prolog logic is now separated in its own basic block. The
first "real" block with user code starts at offset 0.
Having the function prolog as a hidden part of the first block caused
some inconsistencies in block generation and would create empty blocks.
This happened for example when a back edge of a loop would target offset
0 in code where a loop condition is the very first set of instructions
that are run. This is because the target block offset didn't exist due
to it being part of the hidden prolog block.
Validation for the basic blocks was also added. This checks for three
things at the moment:
1. That return and throw blocks don't have jump targets.
2. That the basic blocks graph is connected.
3. That jump targets are the first offset of a block.
Test tst_QmlCppCodegen::basicBlocksWithBackJump_infinite() is expected
to fail because it contains an infinite loop and the basic blocks that
are generated for it are inconsistent due to dead-code elimination
happening earlier in compilation.
Debug outputs for dumping basic blocks were also adapted to reflect
these changes.
Change-Id: I513f73856412d488d443c2b47a052b0023d45496
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Swipe items that are direct visual child of SwipeDelegate control can
consume mouse events. But, if its configured within non-visual item
(such as row or column layout), the mouse events are not being
propagated.
This patch set fixes this issue by identifying visual child that can
consume mouse events at the event position through
QQuickSwipeDelegatePrivate::getPressedItem() and propagate it
accordingly.
Fixes: QTBUG-104904
Pick-to: 6.6 6.5
Change-Id: Ie7458db26d0d5fe1dd767326bb84605d06ba2ae8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The _q_reregisterTimers private slot has been removed from Q_OBJECT in
b902b152af0bf144c9c9833502e1dcfae0166620, and consequently it will no
longer be picked up by engine.
Change-Id: I11f3636092dc66bffa0bc54c3f1dd8fcf36aa691
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The following issues are fixed:
- [1]Incorrect detection of the property name as a string literal and
thus writing out them with quotation marks
- [2] Duplication of property name when a scoped variable is used as
property key
- [3] Writing out additional brackets during deconstruction
- [4] Incorrect formatting when a default is assigned to a lhs variable
like [a = 24, b] = array
- [5] Automatic addition of "" characters into the object keys
- [6] Automatic addition of assignment operator, instead only add it
when there is a pending initializer
Also, add the colon token location which was missing in the pattern
property rules. Remove it from a couple of rules that was giving
incorrect result. We require the location information of the colon token
to be correct when formatting.
A few of tst_qmlformat and tst_reformatter tests are adapted to the
above mentioned changes [1], [2], [5].
[ChangeLog][qmlformat][Important Behavior Changes] qmlformat will no
longer add "" characters automatically in the object keys unless the
object key is actually a string literal. Also, using a scoped variable
as the property key will no longer result in the duplication of the
property name.
Pick-to: 6.6
Fixes: QTBUG-108275
Fixes: QTBUG-114839
Change-Id: I272d41d13df34ff5877f3efebe43c80255dd7c2b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If the test is build as its own project, add_dependency will not be able
to find the target we pass to add_dependencies.
So make the check conditional (and assume that anyone building the test
as its own project has build qmlls before).
Change-Id: I632073f8e0f5cc21374435ba97a2d0ad50c831dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
As mentioned in the comments of QTBUG-68434, popups always inherit
their attributes from the parent window (unless they are explicitly
bound like in ComboBox). However, ComboBox was made an exception,
because the popup is an integral part of the control.
This means that although the following snippet shouldn't change the
background color of a Popup, it should do so for ComboBox's popup:
Rectangle {
Material.theme: Material.Dark
ComboBox {
model: 5
}
}
However, this didn't work.
Before 3ec6d04d97, material/ComboBox.qml
had the following binding in the popup's background Rectangle:
color: control.popup.Material.dialogColor
That patch changed it in order to get deferred execution working:
color: parent.Material.dialogColor
This causes the color to come from the window rather than the popup.
This would have almost been caught in test_comboBox, had we checked the
actual color when setting the theme.
To fix the bug without reverting to the previous QML and breaking
deferred execution, we modify findAttachedParent to return the popup's
attached object if the item passed to it is a QQuickPopupItem.
Doing this causes test_inheritance_popup to fail, so we fix that by
passing the attached object target (which can be a popup) to
findAttachedParent, rather than the item whose parent or window changed
(which is coincidentally what was already being done in initialize()).
The patch also adds categorised logging to help debug such issues in
the future. Conveniently, this will also help users who want to debug
their own QQuickAttachedPropertyPropagator subclasses, without them
needing to modify Qt itself.
Fixes: QTBUG-115322
Pick-to: 6.5 6.6
Change-Id: Idc0495023a058bcb033c4002fb6ad233bae9feae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We shouldn't allow such keys, as they get confused with array indices.
Task-number: QTBUG-115319
Change-Id: Iff37611925ff6aa8463baf26d221fd66ad919f2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The logic in our IdentifierHash assumes that every entry is a
StringOrSymbol; however, IdentifierTable::asProperyKey will convert keys
that look like numbers to ArrayIndex instead.
This is noramlly what we want, and not an issue, except for
setContextPropery where the user can pass an arbitrary string that is
not necessarily a valid identifier. In an ideal world, we would just
disallow such identifiers, but for backward compatibility change the
code to handle this case (avoiding a Qt internal assert).
We only need to modify the QString overloads, as those are the only ones
that interact with unsanitized user input.
A later commit will modify setContextPropery to warn if the key is
numeric.
Fixes: QTBUG-115319
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ifc4e4d2bc99321836e6976c4cbd0c5ff687b430c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Calling both setObservers and prependObservers doesn't make sense:
setObservers is for the case where we don't have a binding, but
obviously we do have one here.
Note that the test case still passes even without the fix - it will
however cause a memory leak which can be detected by ASAN. The leak is
fixed by this patch.
Fixes: QTBUG-115251
Pick-to: 6.6 6.5 6.2
Change-Id: I4b420e05f49acf764da6a05af522390005276f49
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
We can use the same technique as for GetLookup there. Just check the
variant for validity to see if we can call it.
Change-Id: I1bcf4a5a84f47e0236762827488bc5d03e015efb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
They're simple integral types, for all the special semantics they're
wrapped in.
Change-Id: I80934f3feec94b82a8ccdf5f8320b04b18939348
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QQuickAbstractButtonPrivate::pressPoint may not be set correctly,
and we don't need it for this purpose anyway in Qt 6, since every
QEventPoint is supposed to remember its own press position.
Task-number: QTBUG-61783
Pick-to: 6.5 6.6
Change-Id: Idd82f3d79b1167a40f28669d15b5974c7d240a9c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
When animating a flickable with pixelAlignment enabled, the vData and
hData move still contain raw floating values.
The viewport and content items will use the pixel aligned values. We
recheck updateBeginningEnd based on when the viewport changes to emit
the atBeginning/atEnd signals.
If the animations speeds are just right, we can have a frame where the
hData.move is not at the end, but the aligned version is. This will
perform the last check in a way that fails the test for being at the
end, and not update again.
This patch uses the same value for the position as the content, aligning
if needed.
Fixes: QTBUG-115081
Pick-to: 6.5 6.6
Change-Id: I58afbe8a79994507e891391cb8f2af7e22380a9b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
While we shouldn't convert to QVariantMap if only QVariant is requested,
we should convert if QVariantMap is explicitly requested. QVariant can
hold QJSValue which is a better fit for objects with properties.
QVariantMap cannot hold QJSValue. A best effort conversion is still
better than an empty map.
Amends commit 47678c682f.
Pick-to: 6.6 6.5
Fixes: QTBUG-115523
Change-Id: Iaa96809ee411dc0db95311c641c4e3f1f51a6026
Reviewed-by: Amanda Hamblin-Trué <amanda.hamblin-true@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
That makes it more clear which ignoreMessage belongs to which part.
Change-Id: I4c2bcc16b80204c6bb55c18459b7e8b0b1b298be
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
In the presence of incomplete type information we may otherwise conclude
that the value type is QJSValue and generate broken code.
Pick-to: 6.6 6.5 6.2
Change-Id: I533f704a422d0efe8b7b5bb0a170966e9f290b1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If the Date is a NaN, there's no point reporting on the rest of its
failure to match the expected value.
Add a missing semicolon as a drive-by.
Change-Id: I9613d590c5ad9463b4b1b0b76f8b3877dead659c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Otherwise the const wrapper will be swept while the object should still
be alive (and vice versa).
Amends commit d3b3fef5a8.
Pick-to: 6.6 6.5
Fixes: QTBUG-114596
Change-Id: Ib4d8e9f805a229a471ca72f5ff357e3a4c9999a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Method calls often return just QVariant because we cannot be sure that
the method hasn't been shadowed. In order to figure out the right lookup
we should look at the type the type propagator assumed as the base of
the lookup. If the type propagator was assuming a list-length lookup we
need to try and generate a list-length lookup. If the base turns out to
be a QVariant after shadow-checking, the code generation will cleanly
fail (and refrain from generating bad code).
Amends commit 46cc70e2aa.
Pick-to: 6.6
Fixes: QTBUG-115278
Change-Id: I24dcd06161eb1af44450fb663d68a16d89efd6ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We cannot just sort the raw values. We have to take the offset into
account. If the array wraps around the end of the allocation, we have to
move it around to be contiguous.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-58718
Change-Id: I1866b3f271d97352e250d687955af3fc54340334
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We don't need nested hashes there. A single hash is enough, and we also
don't need to key it by pointers. Keying it by internalName instead
makes the ordering deterministic. We also don't need to duplicate-track
the variable names when outputting the declarations anymore.
Verify that qmlcachegen's output is actually stable by compiling the
entire test data for tst_qmlcppcodegen twice, packaging the generated
code into the resource file system, and comparing it in a separate test.
Pick-to: 6.5 6.6
Fixes: QTBUG-115159
Change-Id: I659661e58a52ed9ff308c83d6c821cf016f2e94e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If onSignalHandler is a usage of the corresponding signal, then this
should also be true for property changed signals/handlers. For some
property p, also find onPChanged and pChanged usages (and vice-versa).
Add a heuristic to discern property changed handlers from signals from
property changed signals from etc, which will be also needed for the
renaming operation in qmlls.
Fixes: QTBUG-111414
Change-Id: Idc179a288ef2771c094efadacdeb2a5b5bb89336
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Implement support to find usages of signals defined in QML or CPP and to
find usages of bindings, for the "normal" cases.
"Advanced" cases, which is about using QML objects like Connection or
Binding, will be covered in a follow-up commit.
Finding usages of signals:
Set the semantic scope of a signal's owner inside the signal, to be able
to differentiate between same-name signals of different types during
find usages. This requires to move code from
QQmlDomAstCreator::{endV,v}isit(AST::UiSourceElement*) to
{endV,v}isit(AST::FunctionDeclaration*), such that
QQmlDomAstCreatorWithQQmlJSScope can set the semantic scope in the
signal's MethodInfo during endVisit(AST::FunctionDeclaration*) instead
of endVisit(AST::UiSourceElement*) where the MethodInfo is already not
available on the node stack anymore.
Also implement finding onSignalHandler for signals as part of the
usages, and finding signals when finding usages of the onSignalHandler.
Finding usages of bindings:
Add an "identifier" region to FileLocations of bindings and property
definitions to be able to find the exact location of the property name
inside the property binding/definition. Change the existing tests to
only expect the source location of the property name instead of the
entire property definition.
Add tests for finding usages of signals and bindings and make sure that
functions contain a qqmljsscope in tst_qmldomitem::callExpressions()
and that Qml Object id usages can be found.
Disable a warning about prototypes not being a QmlObject: it is fine if
the prototype is also a QmlComponent.
Task-number: QTBUG-111414
Change-Id: Id6fd04ee7c04293a259588165f13b5ae8c78e9dc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add a set of static helper methods in
src/qml/common/qqmlsignalnames{_p.h,.cpp} to do signal name
manipulations (from signal to signal handler name and back, from
property to property changed signal to property changed handler and
back).
Add tests in tst_qml_common for the helper methods.
ToDo in following commit: replace all implementations of signal name
manipulations out there with the helpers introduced in this commit.
Change-Id: I8e606375839d9eda673da121a60484c5d211f4a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QQmlDelegateModelPrivate::requestMoreIfNecessary() is called in various
situations, including at startup, which calls QAIM::fetchMore() on the
model if it supports that. But we need to do it in one more case:
when delegates are being reused from the cache, the model could provide
more rows even though we aren't instantiating new delegates.
Amends 1841a9e41d
Fixes: QTBUG-95107
Pick-to: 6.6 6.5 6.2
Change-Id: I5b7ff48345ab78977cb03cfcf58ed96a57c831bd
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The token sequence ??= used to be a trigraph for # until C++17 removed
the concept. Clang warns about their use, though, so escape the two
trigraphs in the test suite by splitting them with a pair of "".
Amends 6cca731f3e.
Pick-to: 6.6 6.5
Change-Id: I455883c4ad92541941fc8fed62277c97c24170db
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use std::unique_ptr instead of QScopedPointer as it looks cleaner while
still providing automatic memory management and ensures that memory is
properly deallocated when the pointer goes out of scope.
Task-number: QTBUG-115222
Change-Id: I9ca93c44fee21ab2847540ab1a32f88cc942d293
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This is the result of running util/normalize on the code base. The
following manual edits were needed:
- skipped the hits in IS_SIGNAL_CONNECTED, which is using function
pointers under the hood
- restored the space before * in Q_SIGNAL void foo(QType *arg)
Pick-to: 6.6
Change-Id: I299b3747c1aa2f6b3bc5ae1794edeb6fadfd75c6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
A method can belong to a QObjectWrapper, a QQmlValueTypeWrapper, or a
QQmlTypeWrapper. store only one wrapper pointer and allow for all
variants. Furthermore, keep a reference to the wrapper so that it
doesn't get garbage collected. We still need it to retrieve the
metaobject, even if we're calling the method on a different instance.
Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-115115
Change-Id: I1759fb687918ff79829fef776e0a93d29373b30f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When calling sort after unshift, array entries unexpectedly become undefined.
Task-number: QTBUG-58718
Change-Id: Ie577e6d983f22e02ab4ade3d1f722e7c44c2a981
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
QQuickDeliveryAgentPrivate::pointerTargets() can visit a lot of items
and their handlers, before actual event delivery really starts. One optimization in place since 6adc36115f
is that if an item is clipped, and the point is outside its bounds,
we can be sure that it's also irrelevant to the item's children,
because the parts of any children that may be under that point
are clipped away and invisible. At the time that was written,
QQuickItem::contains() was only doing a simple bounding-rect check.
Since then, bf74a908cb added
containmentMask; and we should also keep in mind the precedence
of the PointerHandler.margin property (currently, TapHandler.margin
does not expand the sensitive area beyond a clipped Rectangle, or
beyond the containmentMask either). So it seems we now need to check
clipRect().contains() explicitly: a child item may be outside its
parent's containmentMask, and containmentMask does not affect clipping,
so one would expect to still be able to interact with the child.
The current definition of clipRect() is from
9b62f4c27a. It's virtual, but
documented as "the region intended to remain visible if clip is true".
Fixes: QTBUG-115179
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: I6ae8f492b99725459cdff2a89ac8508da5167102
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
If we're not creating a new context, we should not re-parent it.
Otherwise it gets deleted in unexpected moments.
Amends commit 471c909a68.
Pick-to: 6.5 6.6
Fixes: QTBUG-115106
Change-Id: Ib51d80dda07096587c64ac2262d115ea08855cd2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Allow reset the group colors of QQuickPalette, and ensure ResolveMask
value of QPalette is right.
Pick-to: 6.5 6.6
Fixes: QTBUG-104008
Change-Id: I57d71f6be73286b78bf0c31927993e39f9fab8d3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
We get rather unusual file URLs if we let an import with an invalid URL
pass. Once those files are referenced, we hit some asserts.
Pick-to: 6.6 6.5 6.2
Change-Id: If7acefcd07c844e680be9db6e49b5ef366baea4b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We were checking the wrong method offsets and we didn't check for
destroy() and toString().
Amends commit 3fd3a2a9d0.
Pick-to: 6.5 6.6
Change-Id: I8ebeb927a7827cc1fd3394fb3ab589c35d31ab70
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If a cache item has an object and there are no pending incubation
tasks, it returns the object.
Otherwise, it releases the object, before deleting the cache item, if
it is unreferenced.
If the cache item's object has a zero objectRef, because it is still
under construction, the method attempts to release it.
Releasing an object with a zero objectRef triggers an assertion in
QQmlDelegateModelItem::releaseObject().
The cacheItem's object is referenced in qqmldelegatemodel.cpp:1234,
which increases the objectRef from 0 to 1. It is set to 0 again,
if the cacheItem has a delegate, which gets incubated in
qqmldelegatemodel.cpp:1281. This case is not reflected later, and the
cacheItem's object is unconditionally released.
This patch makes the release attempt conditional to a positive
objectRef. It adds an autotest in tst_QQmlDelegateModel.
Fixes: QTBUG-104469
Pick-to: 6.6 6.5
Change-Id: I5c0751ca7f796a9701889520c526f719a27a200b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
With this change, qmlcachegen can populate structured value types from
object literals.
Also fix the construction of value types via Q_INVOKABLE ctors. We don't
need to wrap the ctor argument in QVariant if we can store the original
type, and we should always look at the base type for the creatable flag,
not the extension.
Task-number: QTBUG-107469
Task-number: QTBUG-112485
Change-Id: I9f3db13f00466dc9d87237bdf0b380d6eeb58a10
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We don't need a QQmlType in order to find an iterable. We can also try
to convert the QVariant right away. This way we can handle things like
QList<QJsonObject> that haven't been registered. Those were converted to
JavaScript objects and then to QVariantList before, a rather wasteful
procedure.
Amends commit b9bfdea0e2.
Change-Id: Ib3e33e317892ada04e1880c5cbadfcfd614e9398
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Handlers can be sent events that are outside of the target
item, so check for that in wantsEventPoint.
Fixes: QTBUG-111013
Pick-to: 6.2 6.5 6.6
Change-Id: I52f17fc7030a93d999188fe7608411f11d235858
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
If you pass insufficient arguments to call the ctor, the resulting
object is null and cannot be used.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114910
Change-Id: Ib184684b6a7665bcdc1a3fe8f8a2401a33a8ac1c
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We already have a generic warning for assigning null to properties
that don't support it, so we warn twice.
Removed redundant warning so that we only warn once.
This partially reverts commit 16aff415a4.
[ChangeLog][QtQml][Important Behavior Changes] Assigning null to
a property of incompatible type is now an error instead of a warning.
Fixes: QTBUG-102980
Change-Id: I739913ab64628376727b751512717eb4bf7ea5f4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the follow script:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: Ibd12efab09ceb5852395e40f10b55fafb69c1b58
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>