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>
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>
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>
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>
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>
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>
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>
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>
- 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>
Method that returns list of all project infos where this file belongs (similar to methods in cpp module).
Change-Id: I94eb86ffa5bdbee8d794377a03160418b7340662
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
m_fileToPath was not always updated correctly which lead
projectInfoForPath to return a wrong/invalid project info,
messing up the paths used by the code model.
Change-Id: If5e144f1ef2c7353b9077deb1b9c9aa9d1708651
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
builtins were always using qtimportPath, which is now being removed,
so prefer qtQmlPath.
Change-Id: I99d9214c2188507859f27b729c027aaf77eb579e
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
qmltypes files were stored in the snapshot during scan, this is wrong
and bloats the memory usage.
Task-number: QTCREATORBUG-13369
Change-Id: Ie8c3970ad7a8d732230f3dc73a9ba65ab62ea4e9
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
If the qmljsmodel has no background task, then isIdle returns true
Change-Id: I31420343c560c5ed118f371f7be347eadb6622f4
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
setting QT_NO_CODE_INDEXER = 1 disables the qmljs code model,
as consequence the qml designer will not work with this setting.
Change-Id: I71a2989b14e55e4d130463edd4a6459dee3cbd3d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Qt 5.3 is the minimum requirement these days. Remove all fallback code
from sources and project files.
Change-Id: If6188a471197acadda4d6baee71804ba1a8026c6
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
We rely on string comparison for detection of QML import paths. Therefore
make sure that all paths are canonical.
Change-Id: I416bc31915644a888c416d726049668b0e71f29a
Task-number: QTCREATORBUG-12902
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Language::Enum -> QmlDialect
* class instead of enum
* moved Language specific operations to it (from Document)
* nicer handling
QStringList -> PathsAndLanguages
* store language along with path, to perform a correct scan and improve
path handling
Change-Id: If69d35c63cfeb48aa670b51870916cd0c40f1916
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
ensure that the QSet copy operation of the scannedPaths in importScan
is atomic.
Change-Id: Ifb3566a86d1d6ac6abf29f1b4cbe19868947d0cc
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This removes qmakeprojectmanager and qmlprojectmanager dependency on
qmljstools.
Qmlprojectmanager still imports qmltoolsconstants.h for a constant
but that gives no runtime dependency.
Change-Id: Ifd2e76500a3b27a21937603925f03a70049900e1
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>