Commit Graph

175 Commits

Author SHA1 Message Date
Eike Ziller
8b031c8c05 Merge remote-tracking branch 'origin/4.13' into master
Change-Id: I3f2a6c553819e992da7e9f538dc44b95b482359e
2020-10-02 10:47:07 +02:00
Fawzi Mohamed
45716a4ccc QmlJS: set and propagate qtVersion in ProjectInfo
Change-Id: Icbeb3679c8a76c111a5e3503b2c496c28c830342
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-29 14:24:14 +00:00
hjk
43b658e9e7 Utils: Drop Utils::SkipEmptyParts again
We require Qt 5.14 nowadays.

Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 12:42:27 +00:00
Christian Stenger
6e29adaae7 QmlJS: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098
Change-Id: I70157bcbee67cf493e28b5bad97248877a25e5c6
Reviewed-by: hjk <hjk@qt.io>
2020-07-20 10:23:52 +00:00
Eike Ziller
b18711da91 Merge remote-tracking branch 'origin/4.12' into 4.13
Conflicts:
	share/qtcreator/debugger/lldbbridge.py

Change-Id: Ia444f6424fb35b9a539e157afcee868161535272
2020-07-06 16:23:13 +02:00
Christian Kamm
2c2cd08761 QmlJS: Fix codemodel reset
The QML import paths weren't scanned for modules when the code model was
reset.

Task-number: QTCREATORBUG-24082
Change-Id: If818ebf4ef123529e5fe8de40e6b5d0154c84680
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-06-30 08:57:28 +00:00
hjk
54575fe42d QmlJS: More Qt6
Mostly QRegExp, one QHash::unite.

Change-Id: Ia2816fee65b9459c0f89419161f44c38cd572c36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-19 07:13:06 +00:00
Miikka Heikkinen
7f4bf437da QmlJS: Add a way to return just the context of the project of a file
Added ModelManagerInterface::projectVContext() method to return just
the context of the project the file belongs to and nothing more.

To make this possible, fixed caching the file-to-project relationships
and removed automatically adding the currently active project to
list of projects the file belongs to in allProjectInfos().

Task-number: QDS-1495
Change-Id: I949c0202d0280264b6856562a2e7abc2f93d13c0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 12:42:20 +00:00
Christian Kamm
338fa26bc3 QmlJS: Scan import paths, even if there is only one
Previously a single QML import path would not be scanned. This did not
usually happen to users, as there's almost always more than one path.
But it could lead to unexpected behavior in tests that explicitly
controled import paths.

Change-Id: I015f44f183ad484c333ab7a4e5e98b87098620a7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-05-21 07:53:24 +00:00
Christian Kamm
96c860159b QmlJS: Track futures to allow testing
Tests often want to wait for all async tasks to finish before
progressing.

Change-Id: I61738df730ca341b5c9d227569d961cd1991b296
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Philip Van Hoof <philip@codeminded.be>
2020-05-21 07:53:11 +00:00
Christian Kamm
037ff590e6 QmlJS: Fix loading builtin library info
The condition was always false, since projectInfoForPath always returns
an empty project member. This meant the the fallback builtins that ship
with Qt Creator were used, instead of the builtins that shipped with the
Qt version.

Change-Id: I9c3bf949d0046bcf687c913e32ddac95734f6c43
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-21 07:52:51 +00:00
Maximilian Goldstein
2392f29a59 qmljs: Do not use app.qmltypes and lib.qmltypes anymore
Task-number: QTBUG-82710
Change-Id: I876ec2b8e2b668a239248511b0fbd58389098de6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-27 08:17:07 +00:00
Ulf Hermann
1e587831d1 QmlJS: Scan app.qmltypes and lib.qmltypes for type information
app.qmltypes is being added as a new convention to Qt 5.15. These files
are to be found next to application binaries, and contain the QML types
those application register themselves, in contrast to QML types
registered from plugins loaded via the regular import mechanism.

lib.qmltypes works the same way, in principle, for libraries. This
change only adds it to the possible names for qmltypes files, though.

Change-Id: I1d7c5835c8c3e988d214c5cdb949ca677b48dfc5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-10-31 09:07:57 +00:00
Ulf Hermann
58c023e7c4 QmlJS: Clean up qmljsmodelmanagerinterface.{h|cpp}
Avoid foreach, fix linter warnings, simplify types, apply coding style.

Change-Id: I7cec65e775ee14ce60e1e57077e917285d58c152
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-10-29 11:45:32 +00:00
Ulf Hermann
6371725dbf QmlJS: Clean up ViewerContext
The special ctor wasn't used anywhere, the default ctor can be replaced
by inline initialization, maybeAddPath is only meaningful in the model
manager and the language compatibility check should definitely not
pretend to be a general rule either.

Change-Id: I11cf25fe1c696550d33b56ce57316100321d564b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-10-23 10:14:47 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Christian Kandeler
2f7f1aaec3 Move qrc parser from QmlJS to Utils
We'd like to make use of it in a more general context, and it's not
directly related to QML.

Change-Id: I025ec67829f85544667684cdb8c99d1ee4c18197
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-13 11:48:27 +00:00
Tim Jenssen
87746b5906 QmlJS: improve code
- no behavior change

Change-Id: I61e515876be768309e5647261ffbe2732de423b9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-23 10:06:36 +00:00
Tim Jenssen
372e239d2d QmlJS: remove qtquick1 leftovers
QT_INSTALL_IMPORTS and the used ProjectInfo.qtImportsPath variable
were only used for QtQuick1.

Change-Id: I34da0cfc77effa84f3a7578e7f91fed0768a9bf4
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-18 13:16:30 +00:00
Tim Jenssen
0157e009be QmlJS: fix nullptr warnings
Change-Id: Id546a9a5c065ae8b0cc9c251051b2fd36e34803a
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-17 16:14:21 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Orgad Shaneh
eea6a7c3b3 Utils: Purge qtcfallthrough.h
No longer needed.

Change-Id: I9b0bee014df89d4c567f1d2431b5ff9404f5f925
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:13 +00:00
Marco Benelli
b9d72a5737 qmljs: remove remaining references to QtQuick1
This patch removes all references to QtQuick1 in qml library,
plugin, designer, profiler and tests.

Change-Id: Ie286fad96060299caae3ef328330597cf53e90d3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-04-03 14:40:30 +00:00
Friedemann Kleint
f482270432 Introduce Q_FALLTHROUGH()
Silence g++ 7.X warnings.

Change-Id: I9d06d04b496c9ec060e13e1be6f43d8fbadb1f3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-24 14:50:43 +00:00
Ulf Hermann
d81c6c7403 QmlJS: Don't parse files we cannot open
This rids us of the "Issues" about various wizard files when opening
qtcreator.pro

Change-Id: Ib49e87ded791bcc9155e65a77cac523c1f67de56
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-12-07 08:26:28 +00:00
Marco Benelli
c054dd2cff QmlJs: fix bug in resolving qml imports
The introduction of Controls.2 changed the way in which imports are
resolved. This patch fix some leftovers of the old resolution scheme.
Such leftovers caused false positives in import declaration to happen
when resetting the QML/JS code model.
The code has also been simplified a little, by the removal of
duplicate code and of unused methods.

Change-Id: I90bdf7ed47fdfea7cbd8259acd7a9a968f27301b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-16 11:10:17 +00:00
Christian Kandeler
a4aa79a4f8 QmlJS: Rename variable called "interface"
Easily conflicts with a macro of the same name in windows.h.

Change-Id: Ia6dfb294092497c48816e71ff901e9c3b2c8359f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-08-17 09:53:39 +00:00
Tim Jenssen
19239e3770 QmlJs: use initilizer_lists for pairs
Change-Id: I0386d57ad3549814ab197c4e24549705e061c95a
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-04-27 07:45:06 +00:00
Robert Loehning
6344815d0d QmlJS: Abort if file could not be opened
Change-Id: Ic2175c2b8dc6ec8ce378db07bdd2b667b15f70cb
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-04-07 10:23:33 +00:00
Robert Loehning
5c3fce7f97 QmlJS: Fix version detection in updateProjectInfo
Change-Id: Ib8b53e8fdf5e69caf843a34390e820e9221a8be5
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-03-15 18:43:16 +00:00
Christian Stenger
05e8f34d3e QmlJS: Allow forced rescan on already known paths
Qml files used by Quick tests are not necessarily added to the
project file and therefore not fully handled by the QmlJS code
model / snapshot.
When adding qml files to a directory that is handled by the
code model these folders are not scanned again - we need to
enforce such a scan on AutoTest plugin's side.

Task-number: QTCREATORBUG-17805
Change-Id: Ie3d071a9aa03297d618648b06d52fb298c856d25
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-03-08 08:57:34 +00:00
hjk
56409f5afa Replace a few occurrences of QStringList() << ...
... by something shorter.

Change-Id: I363b4e509adb07997517b2d233246a333aea4aea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-02-08 11:21:45 +00:00
Oswald Buddenhagen
424639ecac make resource file handling able to deal with QMakeProject's VFS
resources.prf may create virtual qrc files when RESOURCES contains
non-qrc files.

Change-Id: If591de9b32b775059d67e94bc3cb06d23ee44b08
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-01 17:34:55 +00:00
Ulf Hermann
424005c911 QmlJS: Release the same documents we keep before
When rescanning imports we generally get a new version of the parent
document. When replacing the cached documents we want to release the
old ones, not the new ones. Failing to do so leads to types
disappearing from the QML code model and to leaking memory.

Task-number: QTCREATORBUG-17175
Change-Id: I3994444ac0a6cd87f9d9d0b47ab3d6015660e416
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2016-10-28 11:39:18 +00:00
Orgad Shaneh
670e54345c Remove use of deprecated Qt algorithms
Change-Id: Ib35cffa2d5762874feea9b1d4df7f569c0e5f496
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-09 13:41:25 +00:00
Erik Verbruggen
b47b9ea951 QML: Band-aid fix to prevent a crash
If the document that FindExportedCppTypes is to search is not in the
snapshot, skip over it (instead of passing the shared pointer with a
null-value inside).

Change-Id: I462e3d22aa4e1cc51e710c75ae0f9399c151240b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-07-25 06:22:18 +00:00
Ulf Hermann
1e7bf7f721 QmlJS: Reparse cpp types when component headers change
Previously the code model would only get updated when the document that
contains the qmlRegisterType changed. If the actual component exported
to QML lives in a different file, any updates to that component would
be lost. With this change we keep track of the header files the
components are declared in and rescan if any of them changes.

This is still not the greatest way to do it as there are a number of
ways to introduce dependencies the system cannot detect. It's better
than before, though.

Change-Id: Ic077c516dca3ac720f78973c84e5e6e91b6a5c07
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2016-07-15 16:22:42 +00:00
Orgad Shaneh
7609e56ee3 QmlJS[|Editor|Tools]: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I56550546b341d486d321329e9a90b9369d56af40
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2016-06-28 08:47:26 +00:00
Tim Jenssen
a6d21cc1f7 Qmljs: small QHash improvements
Change-Id: I79a5504c8471b66540aac8047fbcf760ceb6b10f
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2016-06-20 14:08:43 +00:00
Ulf Hermann
35bafd3952 QmlJS: Fix resolution of "alias" directives in qrc files
Previously qrc paths of QML/JS documents were not considered for
implicit imports. Only the path of the document in the file system
was considered. The QML engine, however, doesn't know the original
path at all and only uses the qrc paths for import resolution. This
created a mismatch between what the QML engine could recognize and
what the code model suggested.

Without alias directives, any files imported from a qrc file would
have to reside in the same directory as the one implicitly importing
them, so this arrangement happened to work, most of the time.

In order to support aliases we have to search the files in the same
qrc path to figure out the imports. To do that, we keep a reverse
map of qrc paths to files in the QrcParser and iterate that when
resolving imports.

Change-Id: I84baae6cbfbe96ddd5322c81494c1e4a3f473f3f
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-29 11:20:57 +00:00
Eike Ziller
72af6b7834 runAsync: Remove ResultType template parameter.
It is now deduced from either the type of the
QFutureInterface<ResultType> function argument, or the return type.

Change-Id: Iddab3cc329206c649a6e55a44b2de2d406701dee
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-10 10:58:55 +00:00
Eike Ziller
9074a8c310 QmlJS: Change yet another call of QtConcurrent::run
Change-Id: I417c4dbdf8216e8372578775efe97a0510756520
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-01 08:21:22 +00:00
Orgad Shaneh
a6e6c88ed8 Revert "QmlJS: Exchange unsafe meta calls with QTimer::singleShot"
QTimer::singleShot with a member function pointer or a lambda does
not schedule the invocation directly on the receivers event loop,
even if the timeout is 0. It actually creates a timer in the thread
where QTimer::singleShot is called, which requires an event dispatcher
to be available. Only the timer's timeout() signal then schedules the
invocation on the receivers thread.

We do not want to actually run an event loop here until a timer fires.
Even if a timer with timeout 0 might directly schedule the timeout
event on the event dispatcher without involving actual timers, and
even if that event dispatcher makes sure all events are handled before
deleting itself, it would feel like relying on an implementation
detail.

This reverts commit a2e19ba1be.

Task-number: QTCREATORBUG-15681
Change-Id: I19846ce089d72c971d3cc5927c2ddf563e06de14
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-28 11:50:18 +00:00
Eike Ziller
acdfb09687 QmlJS: Use Utils::runAsync and add some more progress information
runAsync avoids the globally shared thread pool.
updateCppQmlTypes missed some kind of progress information.

Change-Id: I8739761326c2f2a5364c0c1552b3c43b00f1ff28
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-27 12:27:59 +00:00
Eike Ziller
a2e19ba1be QmlJS: Exchange unsafe meta calls with QTimer::singleShot
Change-Id: I5596c3f506f1fb873536c03ed5b8f5df88f5ea06
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-27 08:24:14 +00:00
Eike Ziller
265fa13bdb QmlJSModelManager: Use Utils::runAsync instead of QtConcurrent::run
To get rid of the shared thread pool (and to use the API with the less
ugly implementation).

Change-Id: Ia93977b8b394aff8e410d6d81446c23e32b7aed5
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 13:34:57 +00:00
Eike Ziller
a30c1adc96 QmlJSModelManager: Cleanup uses of QFuture
- Use simple list instead of QFutureSynchronizer (no feature of that was
  used)
- Avoid duplicate code cleaning up the current list of running futures
- Clean list of running futures after waiting for them all to finish

Change-Id: Ia13ee25ab7835fc4f4970d23d20b16cfe6bf6dfb
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 13:28:55 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00