Skip to content

Calls order of q_invokable method #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10,000 commits into
base: 6.2
Choose a base branch
from
Open

Calls order of q_invokable method #10

wants to merge 10,000 commits into from

Conversation

rjcamatos
Copy link

If there are 2 or more methods with the same name but reciving diferent arguments the QJSEngine Pickup the First One declared.

Example:
methodxyz(string)
methodxyz(objptr*)

It picks up the first one passing as argument a string and not the one that i was expecting an object as it was send.

qtprojectorg pushed a commit that referenced this pull request Dec 8, 2023
Using std::binary_search has the requirement that the passed
range fulfils ordering requirements, which was not the case
for the cppKeywords array here.

As the QString doc says [1]:

> QStrings can be compared using overloaded operators such as operator<(),
> operator<=(), operator==(), operator>=(), and so on. Note that
> the comparison is based exclusively on the numeric Unicode
> values of the characters. It is very fast, but is not what a
> human would expect; (...)

Therefore, sort the array accordingly and add an assert to
ensure it will remain sorted.

Fixes an crash/assert when building qtdeclarative with
CXXFLAGS='-D_GLIBCXX_DEBUG':

    /usr/include/c++/13/bits/stl_algo.h:2243:
    In function:
        bool std::binary_search(_FIter, _FIter, const _Tp&) [with _FIter = const
        QString*; _Tp = QStringView]

    Error: elements in iterator range [first, last) are not partitioned by the
    value __val.

    Objects involved in the operation:
        iterator "first" @ 0x7ffc4a2c4f18 {
          type = QString const* (constant iterator);
        }
        iterator "last" @ 0x7ffc4a2c4f10 {
          type = QString const* (constant iterator);
        }
    Aborted (core dumped)
    ninja: build stopped: subcommand failed.

GDB backtrace:

    Program terminated with signal SIGABRT, Aborted.
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007f307e0a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f307e05a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f307e0444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f307e2a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00005639ff90471d in std::binary_search<QString const*, QStringView> (__first=0x5639ffa1a9c0 <QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>,
        __last=0x5639ffa1b2c0 <guard variable for QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>, __val=...) at /usr/include/c++/13/bits/stl_algo.h:2243
    #6  0x00005639ff8fb837 in operator() (__closure=0x7ffc4a2c52bf, word=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:764
    #7  0x00005639ff8fb89e in operator() (__closure=0x7ffc4a2c52a0, name=..., errorPrefix=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:768
    #8  0x00005639ff8fc99b in QmltcVisitor::checkForNamingCollisionsWithCpp (this=0x7ffc4a2c6070, type=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:787
    #9  0x00005639ff8f9dea in QmltcVisitor::endVisit (this=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:341
    #10 0x00007f307f6636fa in QQmlJS::AST::UiProgram::accept0 (this=0x563a002e0628, visitor=0x7ffc4a2c6070) at /home/michi/development/git/qt5/qtdeclarative/src/qml/parser/qqmljsast.cpp:1193
    #11 0x00007f3080159b8f in QQmlJS::AST::Node::accept (this=0x563a002e0628, visitor=0x7ffc4a2c6070)
        at /home/michi/development/git/qt5/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../qtdeclarative/src/qml/parser/qqmljsast_p.h:272
    #12 0x00007f3080212f4b in QQmlJSTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/src/qmlcompiler/qqmljstyperesolver.cpp:173
    #13 0x00005639ff8f0bd3 in QmltcTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltctyperesolver.cpp:19
    #14 0x00005639ff8c02d4 in main (argc=23, argv=0x7ffc4a2c7a68) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:269

[1] https://doc.qt.io/qt-6/qstring.html#comparing-strings

Change-Id: I82ebbcdca4ab90155b935f9af24b3a3821134563
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Copy link

cla-assistant bot commented Nov 15, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 10 committers have signed the CLA.

❌ eskilblomfeldt
❌ Inkane
❌ alcazaco
❌ mitchcurtis
❌ Oliver Eftevaag
❌ vohi
❌ Petrivirkkunen
❌ dilekakcaay
❌ dfaure-kdab
❌ samishalayel


Oliver Eftevaag seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

aavit and others added 28 commits June 1, 2025 16:59
The qml generator would create a child component to group the
animation properties. This now causes qml engine failures if there are
multiple VectorImage items.

Work around by dropping the grouping component and just place the
animation properties in the top level item directly if the QML
generator is going to be used from VectorImage.

Change-Id: I77ac9029093f3259aef9357c056da42f09974763
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
Reviewed-by: Eirik Aavitsland <[email protected]>
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 <[email protected]>
This changes fixes a potential null pointer deference by
adding a null check for popup before accessing its methods.

Previously, popup->findChild<QQuickItemView *>() was directly called
without verifying that popup was non-null which could result in
undefined behavior if popup had not yet been initialized.

Pick-to: 6.10
Change-Id: Id1597dad7fb7c0ea8626d37fbc1541af60298f86
Reviewed-by: Volker Hilsheimer <[email protected]>
This can be reproduced by adding this to the top of ~QQuickItem

    qDebug() << "destroying" << this << d;

and then running "tst_qquicklistview2 delegateContextHandling".

Amends 3d3de0f.

Pick-to: 6.8 6.9
Change-Id: I801e770c173acc5a55cfca4230a60d063b762d65
Reviewed-by: Fabian Kosmale <[email protected]>
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 <[email protected]>
The scenegraph is not initialized when the window has not been
exposed yet, and calling QQuickWindow::grabWindow() takes a whole
different code path in this case. This was not communicating a
scale factor to the renderer at all.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-116675
Change-Id: I73b21dfd06a04dbdc2ff3cb1a17bbe0364ca0624
Reviewed-by: Tor Arne Vestbø <[email protected]>
[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 <[email protected]>
We need to expose the meta-object, so that qmlsc can make use of it in
direct mode. We do not need to export the class wholesale, as all
methods are actually inline.

Fixes: QTBUG-135795
Pick-to: 6.10 6.9 6.8
Change-Id: Ia48152b2250012e48f17eed23f0150c4c89c3fc7
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
By design, \styleproperty should be closed with \endstyleproperty. This
was not the case for one subsection. While mostly harmless in HTML, this
cause the DocBook export to be invalid.

Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Ie4172535ffb9183e9105bf7e9b407d834459486c
Reviewed-by: Mitch Curtis <[email protected]>
Fixes: QTBUG-134403
Pick-to: 6.10 6.9 6.8
Change-Id: Ibfbe6bc513d1e279d3d1d21661f8041500f02570
Reviewed-by: Laszlo Agocs <[email protected]>
Rename static variable ROWS_PROPERTY_NAME in qqmltreerow.cpp which
clashes with a static variable of the same name in qqmltreemodel.cpp.

Amends b0e38f6.

Pick-to: 6.10
Task-number: QTBUG-115140
Task-number: QTBUG-130571
Change-Id: I450203f6581715e9c644642c9b76aed17ed0658e
Reviewed-by: Mate Barany <[email protected]>
Pick-to: 6.10
Change-Id: I0e465f127cdd48a582f098bd906c60f1b43d2a5a
Reviewed-by: Mate Barany <[email protected]>
- Fix else after return
- Use std::make_unique
- Avoid copying expensive classes
- Use std::move for constructor parameters
- Other cosmetic issues

Pick-to: 6.10
Change-Id: Ib25b59d1b913682d8d05829dbf8c69d47633d6c1
Reviewed-by: Mate Barany <[email protected]>
Pick-to: 6.10
Change-Id: I156efd2922c3ad613943ad5fec4eea035b991a6e
Reviewed-by: Richard Moe Gustavsen <[email protected]>
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 <[email protected]>
The singleton Color instance is part of QtQuick.Controls.impl module and
so it's required to import this module to access it in the respective
dialogs.

Task-number: QTBUG-127605
Pick-to: 6.10 6.9 6.8
Change-Id: Ie559ff234422e6f2c58d3cd37652c5f396a99d39
Reviewed-by: Mitch Curtis <[email protected]>
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 <[email protected]>
char->QChar conversion is deprecated. Replacing the string literal
restrictedChars with an array of QChar
Amends 5a2a6a8

Pick-to: 6.10
Change-Id: I576b20d8d3c653d45bc2620b7f19afa2fd9f6814
Reviewed-by: Ulf Hermann <[email protected]>
The row can be -1, denoting an invalid index. This would previously
crash the sidebarStandardPaths() test, which was masked by our testing
strategy.

Pick-to: 6.10 6.9 6.8 6.5 5.15
Change-Id: If01b83990ec0393088b518526ff3d3acaab703cc
Reviewed-by: Axel Spoerl <[email protected]>
We might otherwise be able to receive stray signals during deletion.

Amends commit a269db6

Pick-to: 6.10
Change-Id: I1797247971d56b1616357f113dfabc48a80b7901
Reviewed-by: Fabian Kosmale <[email protected]>
We might otherwise be able to receive stray signals during deletion.

Amends commit a269db6

Pick-to: 6.10
Change-Id: I199fe95f3669cdbf3fc80b0f862895eb3cc17440
Reviewed-by: Fabian Kosmale <[email protected]>
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 bfdf1bf

Fixes: QTBUG-137035
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic56087e2cb5ffd33b4659b411ad8954a4c15e0fa
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
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 <[email protected]>
It has wanted to be a syntax error since Qt 5.12.

[ChangeLog][QtQml] Using a bare function expression in eval() is now
correctly recognized as syntax error. You have to surround it in
parentheses to make it a statement. This has been generating warnings
since Qt 5.11 and it should have become an error already in 5.12.

Change-Id: Icb80ff62bf75d3510c43767ccc3477600af6cb63
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Olivier De Cannière <[email protected]>
…ed twice

In the affeted row in the patch, it should be QQuickTableView::AnyKeyPressed,
and not QQuickTableView::EditKeyPressed.

Change-Id: Ib8493bbfbdf0528b740974c3a5f2f1c22371ac9f
Reviewed-by: Santhosh Kumar <[email protected]>
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 <[email protected]>
Somehow, qt_windows.h gets in the mix which has the 'interface' define.
Rename the variable.

Pick-to: 6.10 6.9
Task-number: QTBUG-115140
Change-Id: I6d46d66d0db3350a975984bcc6c4858214615c8b
Reviewed-by: Ulf Hermann <[email protected]>
The release-v2.0 branch actually pointed to the v2.0.1 tag at time of
importing.

[ChangeLog][Third-Party Code] Clarified that exact version of yoga
library is v2.0.1.

Pick-to: 6.10
Change-Id: I78b594d3603640dc979e3377e483c29d14ad81ef
Reviewed-by: Santhosh Kumar <[email protected]>
Petrivirkkunen and others added 30 commits June 30, 2025 09:43
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 <[email protected]>
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 <[email protected]>
Pick-to: 6.10 6.9
Change-Id: I20b14a0e53ac392abaa0044323ccbe29d4037b09
Reviewed-by: Giuseppe D'Angelo <[email protected]>
Skips crashing signallistener test.

Task-number: QTBUG-138104
Pick-to: 6.10
Change-Id: I64e58f5e0cdd5d64254271543a479054f5f118e6
Reviewed-by: Assam Boudjelthia <[email protected]>
Change-Id: I6c04eecc1c11c871222f365b8ea621977c8ea6ba
Reviewed-by: Qt Submodule Update Bot <[email protected]>
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 386e085 to address header
review comment.

Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: Id5e242be274ef173bc89e281e6e6db5ce758914c
Reviewed-by: Marc Mutz <[email protected]>
We already have a QByteArray that we can print directly, so no need to
go through a QString.

Amends 386e085.

Task-number: QTBUG-133858
Pick-to: 6.10
Change-Id: I89768a1faf1ead2e763215348f8defbbeaeaa93e
Reviewed-by: Marc Mutz <[email protected]>
Change-Id: I5a9e5f75e3beee2c690630acc3632bad133e63f1
Reviewed-by: Fabian Kosmale <[email protected]>
Task-number: QTBUG-133315
Pick-to: 6.10 6.9 6.8
Change-Id: I2c3752fe900c65133a12470c567196640e142b31
Reviewed-by: Fabian Kosmale <[email protected]>
Change-Id: If1921a5252c87f949f79d31144f7281b08892778
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Sami Shalayel <[email protected]>
Task-number: QTBUG-133315
Task-number: QTBUG-123386
Pick-to: 6.10 6.9 6.8
Change-Id: I65dc2056b46b1b7a2b381805b53a6ef32c457aa3
Reviewed-by: Ulf Hermann <[email protected]>
As the name implies writeRegion takes the region into account. This
helps keep the comments in the right place. If we write the content of a
region manually, any comments that are associated with it may be left
behind and removed from the formatted code.

Additionally, use ensureSpace instead of baking the space into the
written string to avoid superfluous space insertions.

This change was not applied everywhere as we don't have region types
for every use case of write. They will either have to be added to cover
the remaining entries of be deemed out of scope. One such case is the
use of .pragma directive at the top of a JS file.

Task-number: QTBUG-133315
Task-number: QTBUG-123386
Pick-to: 6.10 6.9 6.8
Change-Id: I30e0b5ec354e46fdcef18b068618a0368555bd41
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Semih Yavuz <[email protected]>
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 <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
Pick-to: 6.10
Change-Id: Ieafa5b40a3c43646ec89649afec80d0748ccfa2f
Reviewed-by: Dilek Akcay <[email protected]>
Reviewed-by: Mitch Curtis <[email protected]>
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 <[email protected]>
See comment on 455f316 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 <[email protected]>
Change-Id: I5d3bcd97d28219ee193aa1b300df52b33cad5af9
Reviewed-by: Qt Submodule Update Bot <[email protected]>
Change-Id: I2aa3a54256423b1a191224f1bb7283d36b606c10
Reviewed-by: Fabian Kosmale <[email protected]>
This method no longer exists, since the switch to RHI.

Pick-to: 6.10 6.9
Change-Id: Ibf8cccfa0fe426bbe2814c017edffac9455c0650
Reviewed-by: Giuseppe D'Angelo <[email protected]>
Reviewed-by: Laszlo Agocs <[email protected]>
Task-number: QTBUG-137318
Pick-to: 6.10
Change-Id: I01112d5c37e49a2423249fb4065be91c6f7964f3
Reviewed-by: Mitch Curtis <[email protected]>
Nobody uses it.

Task-number: QTBUG-134652
Change-Id: Ibee5316fa927c3f2ad8fbe0b610666d85bc827eb
Reviewed-by: Fabian Kosmale <[email protected]>
We only want the static functions. The rest is useless.

Change-Id: I3f174b4538c67f4e228c597b3bf8b5b4183abd7b
Reviewed-by: Fabian Kosmale <[email protected]>
Coverity-Id: 482101
Change-Id: I728fa527d5fd561c9893396a0e1edf3f2d43e4e5
Reviewed-by: Olivier De Cannière <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Amends a3863b2

Pick-to: 6.10 6.9 6.8
Change-Id: I756621e2ac6d57a555395cb69914e2d0b4431d0e
Reviewed-by: Fabian Kosmale <[email protected]>
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 9e13782

Pick-to: 6.10
Change-Id: I6ee7a796a0b4890393d5b17ebea2686c55955394
Reviewed-by: Ulf Hermann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.