The type propagator currently skips all subsequent instructions as soon
as an error occurs. We want to be able to provide more than one warning
at the time within the same binding/function.
Therefore, stop skipping all instructions on the first error. The output
accumulator is set to a var after an error to avoid leaving it in an
invalid state and to be able to reuse later code. Some extra checks were
also added to avoid crashes.
Fixes: QTBUG-127624
Change-Id: Ifc0389767a067181c6e3ba4d5c3fc1a0597c29ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The test focusAfterPopupClosed(), checks to see that the delivery agent
causes correct updates to which item has active focus in a given scene.
However, when using popup windows, a popup's popupItem is moved into a
different scene, and the delivery agent won't respond the same.
We already have tests in tst_qquickpopup, to verify similar behavior
with popup windows.
Set the value to be explicitly Popup.Item, in case we change the default
value in the future.
Task-number: QTBUG-126553
Pick-to: 6.8
Change-Id: Ie1b2319adafc2b1a616d6b153fee49ac472a972c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The test isn't designed to work with popup windows.
In case we change the default popupType to be Popup.Window, in the
future, we'll need the value to be explicit for this test.
Task-number: QTBUG-126553
Pick-to: 6.8
Change-Id: I97c8258889b3d283b7871c5711a2be3e458a03d0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Since QQmlObjectModel does not own its elements, we cannot assume
anything about their life cycle. Observe the elements using QPointer and
do not access them anymore when they are dead.
Pick-to: 6.8
Task-number: QTBUG-124345
Change-Id: I3ba806ae2bbc6ec0b0d97ae6c51cea32e25d4508
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The test test_anchors() in tst_popup.qml checks the success of centering
a popup by querying its local position. This does not work for top level
windows and so an extra calculation has to be added using the global
co-ordinates of the popup to find its local position. There is also a
bug when centering the popup in the overlay, and the overlay is not the
parent. This bug is a result of not translating the expected results to
the co-ordinate system of the parent.
Task-number: QTBUG-126553
Pick-to: 6.8
Change-Id: I9605b6fd290180f777afd35573163fd3c9eff95f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
The qquickapplicationwindow tests are failing when run locally because
the window is not activated after it is shown.
Task-number: QTBUG-126553
Pick-to: 6.8
Change-Id: I6c429016a0271b03581d3077f052ad46afbe5b09
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
We may not need all the includes we generate since we may be able to
rely on transitive includes in some cases. At the same time, not all
includes may be available since people don't always add all the include
paths. Where both of those conditions hold, we can still compile.
Pick-to: 6.8
Task-number: QTBUG-127442
Change-Id: I8a223ab62ee3bef777230d85074363f575c592bd
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
If a header contains only types that are used as base types we don't
need to include it in the generated code, since those have to be fully
defined.
Pick-to: 6.8
Task-number: QTBUG-127442
Change-Id: I4fda16f60dab014fcf4a2a8ba51e120e6fb767fc
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
When using nested Flickables, inner Flickable consumed wheel events even
when it didn't move the view. Touch input and touchpad scrolling
correctly propagated the events to the outer Flickable.
This patch adds additional logic to the code path handling wheel events
for view movement to not accept the event if the view doesn't move.
Additionally a test for this is added that checks that the outer
Flickable moves in this case.
Fixes: QTBUG-126514
Pick-to: 6.8 6.7
Change-Id: Ia03bd1d0cda1ce417baa479dceddb4a16eafead9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
So far we could assign QObjects of any type into any QmlListWrapper of
another type. This is UB, since you may be holding the underlying
QQmlListProperty in C++, and it's also not very consistent.
Assign null instead if the type doesn't match and emit a warning.
Likewise, also warn when initializing a list with mismatched elements.
[ChangeLog][QtQml][Important Behavior Changes] Assignments to list
properties in QML are now type-checked. Before you could, for example,
insert a plain QObject into list<Item>, producing undefined behavior.
Now it instead inserts null and warns. In particular, if you assign a
JavaScript array of random objects to a list property, QML will check
each individual element, and insert null as well as warn when
encountering type incompatibilities.
Pick-to: 6.8 6.7 6.5
Fixes: QTBUG-127343
Change-Id: I9b78afcd3ed40c80175a99861373588f56683954
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Sort the results from QQmlCodeModel::fileNamesToWatch and remove
duplicates to avoid searching for the same files multiple times.
Track files that do not exist in the source paths (for example the
headers from Qt Quick) and ignore them for the next run of
findFilePathsFromFileNames().
This allows qmlls to be much faster, for example when using completions
on the todo qtdoc demo where qmlls tried to search 600 non-existing
files, including files with empty file names and duplicates) in the
source folder.
Pick-to: 6.8
Fixes: QTBUG-126576
Change-Id: I67a0aa84fb4e9286760a68ae9766823ec165936a
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The typical use case for SwipeView is that the user declares items
directly as children. Those children are added to its QQmlObjectModel,
which are then used as the delegates for its ListView. ListView culls
the items it manages, but in the case of a zero-sized view, those that
are outside the view - and hence not in its visibleItems list - are not
its responsibility. That responsibility instead falls to
QQuickContainer.
It's also necessary to clear and return early in
QQuickItemViewPrivate::layout if the size of the view is zero,
otherwise the tests that check if a valid-sized view is made
zero-sized fail.
Add a new C++-based test for Container which is only run with the Basic
style (similar to e.g. tst_qquickmenubar) so that we can check the
culled member of QQuickItemPrivate. tst_container.qml is run
with all styles (even though it probably doesn't need to be, but it
would also be difficult to rewrite in C++, even though it's fairly
small).
Fix some tests that were using zero-sized views.
Fixes: QTBUG-125416
Pick-to: 6.5 6.7 6.8
Change-Id: Ia05791b69568d51bea310e4f09266645ca2f1829
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Changes to avoid false timeout failures on slow hardware:
- Avoid doing grabs while the scene has not yet stabilized.
- Make the timeout for scene stabilization settable, copying the setup
from the Quick3d scene grabber.
Pick-to: 6.8
Change-Id: I2f65ffdf3b52a6cd5833dad739e806932ea205a1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When syncView is requested to do a relayout, it will tell
the sync children to do relayout as well. A relayout alone
will not change the top-left delegate item in the viewport,
only layout the existing delegate items.
But as it turns out, it can happen that the relayout leaves
empty space in the viewport that needs to be refilled with
new rows and columns. This is typically the case if some of
the columns were resized smaller than what they used to be.
And this can change which cell ends up as top-left, or
move it to a different position.
We therefore need to extend the check in syncSyncView to also
include the _position_ of the top-left cell, and not only if
the top-left cell itself has changed.
As it stood, we also did a viewportOnly rebuild every time a
new row or column was flicked into the viewport. This is very
unnecessary, and slows down performance. Instead, we only need
to do this when if the sync child is told to do (at least)
a LayoutOnly. Only then can any of the visible rows or columns
have been resized.
Fixes: QTBUG-127809
Pick-to: 6.8 6.7 6.5 6.2
Change-Id: I815a47e9d6453871172ff7136f8cfbd51a5bc789
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Previously ListView models containing Q_GADGETs did not support
sections, as those expected a QObject. Add support also for getting the
properties from Q_GADGET. Includes autotest.
Task-number: QTBUG-124175
Change-Id: I91878304bdd45ac8d3c6695f0e734a252c69f302
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The documentation says that acromatic colors have a hue value of -1.
QColor does already accept -1 in the fromHsv/Hsl functions.
Fixes: QTBUG-127034
Pick-to: 6.8
Change-Id: I62928e4fe4b9ca569df13c5b82e9de028a7c09ff
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Enable fail on warnings for all tests in init() method.
Also, as a drive-by change, replace 'var' with 'let'
Task-number: QTBUG-98718
Change-Id: I5d9158e2834a5c04f21e47377478fa56267dcb59
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
It's better to have the assert condition w.r.t to the context object
within the model where we access the respective data. This patch
removes the existing assert in the QQmlTableInstanceModel::object() and
uses a similar validation inside the
QQmlTableInstanceModel::incubateModelItem() before accessing the
context-specific data.
Fixes: QTBUG-126981
Pick-to: 6.8 6.7 6.5 6.2 5.15
Change-Id: I799476434afc4c22c8b39544bc994232d6bf8ef2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use the build system to generate the qsb file.
Fixes: QTBUG-125580
Pick-to: 6.5 6.7 6.8
Change-Id: Iefc910356a931109b9c4b60eda1ca145bc3c5079
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
qmllint was wrongly complaining about missing types because
qmltyperegistrar was not including all required types in the qmltypes
files.
Add a regression test to make sure that we don't run into the problem
mentioned by Mario Emmenlauer in the linked task at QTBUG-118112.
Task-number: QTBUG-118112
Pick-to: 6.8
Change-Id: Id67e9f9927e94ad5aa900c7bf30e85fc977e3e45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It seems that this category is just not ready to be enabled by default,
so disable it.
Tracking the work to re-enable it at QTBUG-127812.
Fix a test to enable the category before testing for the warning.
Pick-to: 6.8 6.7
Fixes: QTBUG-127650
Change-Id: I6144e4b55e3bea803b14d82f6f0d291676d4394e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If the QGuiApplication forwards a key event to an active popup, and the
popup consumes the event, it will not be sent to the active focus window.
The ComboBox relies on the popup not getting focus, when dealing with
key events, and won't work as long as the PopupWindow gets and consumes
the keyboard events.
It makes sense to only have popups consume events when it has explicitly
been given keyboard focus.
In addition, unblacklist popupWindowFocus after some tweaks. It's an
important test which verifies various things related to focus.
Unfortunately, due to unknown reasons, it still doesn't pass on QNX.
Task-number: QTBUG-121363
Pick-to: 6.8
Change-Id: I459c91c5db5c392e997aa996f03ecdda093a544a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only and all
build system should be BSD-3-Clause.
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.8
Task-number: QTBUG-121787
Change-Id: I9da6b82b6d620e72d5c6700e3d5901f9049f89e9
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
In order to pass the argument to a value type ctor we need to store it
in something we can rely on.
Amends commmit dd731b880b
Change-Id: I5d1ef6b4611aad9b595235f4f874ef4a063f04c6
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Bind width to the ListView's width, not the parent, which may be null.
Pick-to: 6.5 6.7 6.8
Change-Id: I020d23bb0c98b3da00db9ffd3400a89cfdeb1810
Reviewed-by: Doris Verria <doris.verria@qt.io>
SNIPPETS_DIR needs to be updated after the merge of qtquickcontrols2
into qtdeclarative.
Pick-to: 6.5 6.7 6.8
Change-Id: Ic2ceabd34b35a64868e6b7e261dca19b46c7f195
Reviewed-by: Doris Verria <doris.verria@qt.io>
Dragging an invalid item in the header view leads to a crash. It's
better to safeguard before operating anything w.r.t. to the dragged
item.
This patch fixes that issue by validating the invalid item before
performing drag operation. Also added an test case to verify the same.
Fixes: QTBUG-127782
Pick-to: 6.8
Change-Id: I95398c7410d6fb6427ec06ff4b7da42472bc6d18
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Both the object and the listmodel may be deleted during the life time of
ModelObject. Don't crash when that happens.
Also, fix QV4QPointer to actually name the type of the pointer it
stores. Apparently this is the first time we add a QV4QPointer of
something that's not a plain QObject.
Pick-to: 6.8 6.7 6.5 6.2 5.15
Task-number: QTBUG-118024
Change-Id: I208d8749bcd67970f7bfbe569eed7a472f909508
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Fix tst_qquickmaterialstyle which fails to configure when Qt is
built with -DFEATURE_quickcontrols2_material=OFF. So we just add
an appropriate check to handle this.
Pick-to: 6.8 6.7 6.5
Change-Id: Ifdf3f22e515d1439364f12ec4a3bdad5c85acd85
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Fix tst_qqmlecmascript which fails to build when Qt is built
with -DFEATURE_widgets=OFF. Simply use QCoreApplication instead
of QAplication where appropriate.
Pick-to: 6.8
Change-Id: I8b1a5c162e7fef02c876e8981d9810035770f2b4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Fix the use of module qualifiers when generating snippets for all
three completion cases.
Let `import QtQuick as QQ` be an example, where the user wants to
complete a State snippet:
1. `QQ` -> insert `QQ.State { ... QQ.PropertyChanges { ... } ... }`
2. `QQ.` -> insert `State { ... QQ.PropertyChanges { ... } ... }`
The third case arises when there QtQuick is imported without qualifier:
3. `Sta` -> insert `State { ... PropertyChanges { ... } ... }`
Add tests for all three cases, and a method that creates the snippets
with the correct qualifiers. This avoids:
* getting `QQ.QQ.State ...` completions with duplicate qualifier
* getting `QQ.State ... PropertyChanges ...` completions with
unqualified PropertyChanges
Also fix the snippet completion to avoid suggesting the wrong snippets
inside of bindings, like
`someProperty: stat` -> `someProperty: states: [...]`
for example.
Also fix the indexes in the tests to reflect the new policy for
completion on `.`.
Pick-to: 6.8 6.7
Fixes: QTBUG-127609
Change-Id: I1c70c661a15961b99157d9dc9e8de5e3320433c3
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Do not confuse completion requests on dots with completion requests on
identifiers.
Fix itemsFromTextLocation to return the binary expression instead of
the right hand side of the fieldmemberexpression for the location of
the dot: for example, if you try to get the DomItem for the `.` in
`object.member`, then you would previously get the DomItem for the
ScriptIdentifierExpression `object`. With this patch, it will return
the BinaryExpression `object.member`.
We usually assume that sourcelocations have inclusive ends, for example
we assume that auto-completion on `\n` in `someName\n` wants suggestions
for `someName`, even if its technically one position "outside" the
sourcelocation of `someName`. This is not true for
ScriptBinaryExpressions, where auto-completion on `.` in `someName.` should
not return suggestions for `someName`.
The same also applies to probably all binary expressions `+`, `-`, and
so on. Therefore exclude the position behind the sourcelocations when searching
for items inside ScriptBinaryExpressions in itemsFromTextLocation.
This requires adapting qmllsutils to the "new fieldmemberexpressions" as:
* ScriptIdentifierExpressions for completion inside of them, for example
`member` in `someObject.member`. isFieldMemberAccess() returns true on
those.
* ScriptBinaryExpressions for completion on `.`.
isFieldMemberExpression() returns true on those.
Adapt the offsets of the tests on completion on `.`.
This breaks some tests on qualified module identifiers, so QEXPECT_FAIL
them and track their resolution via QTBUG-127609.
Pick-to: 6.8 6.7
Fixes: QTBUG-127586
Change-Id: I82726205c7401e43174cc7749372e0776063bcbb
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Extend qqmllsutils's resolveExpressionType to resolve signal handler
parameters: they have the specificity that their type has to be searched
from the signal's definition, and can't be added via type annotations.
Implement the special signal handler parameter type resolution in
separate static resolveSignalHandlerParameterType() method.
Add tests for signal handler parameters in
tst_qmlls_utils::resolveExpressionType and tst_qmlls_utils::completions.
Note that implementing the signal handler parameter type resolution is
enough for the completions to work on those types.
Also fix resolveSignalOrPropertyExpressionType() to properly recognize
autogenerated property changed signals (to avoid mismatches with
QQuickWindow's colorChanged signal, for example).
Pick-to: 6.8 6.7
Fixes: QTBUG-127458
Change-Id: I7fc9d198564320485bb8e3527943c4994c02d90f
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
If we remove a binding we don't want any later code to restore it. This
works quite well if the binding we remove already exists.
removeFromObject() resets the binding bit and that settles it. However,
if the binding doesn't exist yet, we so far didn't reset the bit and
when the binding appeared we would still add it to the object. That was
quite wrong.
Pick-to: 6.8 6.7 6.5 6.2
Fixes: QTBUG-124553
Change-Id: I58c115d78b3701ad4e8837772261a9154b971dbb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Fix the highlighting of the enumvalues in the form of
ComponentName.EnumName.EnumValue. To access the external qmlfiles in the
same directory, change the dependency option to default in the
highlighting test.
Pick-to: 6.8
Change-Id: I5dbd94aa6bbb80af9edc50f54fe95ed8cdd6c3cd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Append to m_seenModuleQualifiers right after the prefix check.
Otherwise, the method can early return before having chance to
insert prefix to m_seenModuleQualifiers.
Amends c126ac9a08
Pick-to: 6.8
Change-Id: I11de1dadfae55dd5a2f826c6b3ee8bcbaf58df7d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
The slider naively assumed that all wheelEvents would have either
angleDelta().x(), or angleDelta().y() set to 0, when in reality those
numbers can be any floating point value.
Choosing the largest of the two deltas, is a more robust solution.
Pick-to: 6.8
Change-Id: I1fb75eb5121c99c9b354e53732ec6981f477e283
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
A few recently added font properties were missing from the
QQuickFontValueType::create() function, meaning that they could
not be added to the object created with Qt.font().
Pick-to: 6.7 6.8
Change-Id: I511e8f1e3a3804d8e48943e734e42019941b0452
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The tumbler warning in qmllint does deliver false positives, even on the
code used by the documentation. Disable the warning for now, and use
QTBUG-127562 to track work on fixing the tumbler warning.
Add a test for the tumbler where the warning should not be received.
Pick-to: 6.8 6.7
Task-number: QTBUG-127562
Change-Id: Ia403b2d3aec0991613bf444d0047aa040db2bf65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Rename runtime warnings and qmllint warnings to be uniform, instead of
having many different formulations for the same problem.
This makes it easier to document them, at least for the qmllint warning
documentation.
Pick-to: 6.7 6.8
Task-number: QTBUG-118112
Change-Id: Iabb3a5fb0679523764b9f2fe2d99f4eb93a13c88
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add some duplicate checking into tst_qmllint, and QEXPECT_FAIL all the
other tests that print duplicate warnings (those are tracked via
QTBUG-127691!).
Task-number: QTBUG-127650
Task-number: QTBUG-127691
Change-Id: I66c3ce96db0543244351cd443a637b9a47fefe43
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add a return where missing to avoid complaining multiple times about the
same issue.
Pick-to: 6.7 6.8
Task-number: QTBUG-127650
Task-number: QTBUG-127691
Change-Id: I14e8d12f1e5b4dfd9a7453a2f8206502f5858a85
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>