Add ModelManagerInterface *ModelManagerInterface::instanceForFuture()
method. If the returned instance is not null, it's guaranteed
that it will be valid at least as long as the passed QFuture object
isn't finished.
Use instanceForFuture() in Link c'tor, as it's called from
non-gui thread.
Change-Id: I7e5ee6ad27e8f71cc0cef7fd9a91b710e2f8f662
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
It is possible to import components of different paths to fill
a module.
Take further paths into account when looking up types.
Fixes: QTCREATORBUG-24405
Change-Id: I8d6bf0a324ea9c0d1fe9d91b40857f91f00dd662
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
If the QtQuick import was less than 2.15 implicit dependencies
were not properly resolved.
For example if a type from a module derives from QtQml.QtObject.
Change-Id: I42a3320ee91496da0991de2018efcd124d56f6cd
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Suppress error message if either the current or the sub import are
optional.
Change-Id: I6ab8592c6aa8b20576bfa897e432d317f8a7e3b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add most changes to the qmldir parser of Qt6. This is not a direct
application of the changes because they rely on changes to QtBase that
are Q6 only.
Ignore load errors of optional dependencies.
Fixes: QTCREATORBUG-24772
Change-Id: I0b85818b602c8c7c1712e52318b4ca3f15364cc5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This helps with resolving QEasingCurve's prototype, which is only
available once QtQml has been loaded.
Task-number: QTCREATORBUG-24142
Change-Id: Icb19491071c195c16c527bd206ffdea6f5806b4e
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
qmldir files can have lines like "import QtQml". These were already
parsed, but not stored in LibraryInfo. Store them.
When imports are resolved in Link and a library has such an import, also
load the module it refers to, with the same version and "as" scope.
Add a test to verify the behavior works.
Change-Id: I80b260bfaa36a9e5de0849fa5632b3361077ef01
Task-number: QTCREATORBUG-23986
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* parser side support for annotations, inline components, new UiVersion
and all the things included in QT 5.15 parser
* SourceLocation moved from QmlJS:AST to QmlJS
* Visitors now need to handle throwRecursionDepthError
* BaseVisitor for visitors that want to override all visit
Task-number: QTCREATORBUG-23591
Change-Id: I682a30d0b08b6c929739fd0e339ef6fbde3eb630
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
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>
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>
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>
Types information for qbs is more limited that qml; this causes
qtcreator to raise false positives. This patch relax the checks and
provide some type information needed by qbs files generated by the
wizards.
Task-number: QTCREATORBUG-19757
Change-Id: I07a1dd9d8fedaf4c5c751c2f00643f15ae39127a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
... by additionally keeping local (currently non-owning) pools per
"interesting" type.
Current situation:
- The global object pool does not scale well for looking up
objects, as iteration plus qobject_cast typically iterates
over all pooled objects.
- User code that can use typed results from the object
pool need to have access to the full type definition anyway,
i.e. depend on the plugin of the target class anyway.
The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.
This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.
Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".
Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
The designer has to be able to handle this error/warning
explicitly. To be able to identify the warning I added
a special severity.
Change-Id: I99571497f7327a7857244ef48334c14a254c8ca0
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This is a real bottle neck on Windows
and I do not know of a case where it is required.
Change-Id: I99ebf3bfdd22cfb0ed82d6d39eeb83f079f654d6
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
In standalone tests there is no instance of ExtensionSystem::PluginManager.
Change-Id: I890016c4e0d2fbb41cfc0a5614e936d31e43cd0f
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Modules used to be searched by name with optionally an attached
version. Now, if a module with version is not found, the version is
attached to the parent module.
Task-number: QTCREATORBUG-16145
Change-Id: Ie0f30d4df64d13b3ec4c5ee38e9ad9215ae56420
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
With this patch it is possible to specify QML_IMPORT_PATH in
CMake projects and QtCreator will scan those paths.
One only has to make sure that the variable which is set in the
CMakeLists.txt is also added to the CMakeCache.txt
Task-number: QTCREATORBUG-11328
Change-Id: I11c7694806664d3203d855983e7db4a89fac267d
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@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>
This patch allows a plugin to insert custom imports. These imports are
used by QtC for syntax highlighting and code completion. This way a
plugin can register types and objects that are available only at
runtime.
This is an example of an imports function implementation:
QList<Import> MyPlugin::imports(ValueOwner *valueOwner, const Document
*context) const
{
// context is needed to know from which project is the opened document
// in this example we don't care about multiple projects
Import import;
import.object = new QmlJS::ObjectValue(valueOwner, "<defaults>");
import.valid = true;
const ComponentVersion version(1, 0);
import.info = ImportInfo::moduleImport("MyPlugin", version,
QString());
auto myType = valueOwner->newObject(nullptr)
myType->setMember("myProperty", valueOwner->valueOwner->intValue());
// add more properties & methods/signals to myType
import.object->setMember("MyType", myType);
// in this example we return only one, but you care return more than
one
return QList<Import>(import);
}
Change-Id: I395c273c7b15a9e4ed5a89a81d70ff92db2b7c0c
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
next if file =~ %r{src/shared/qbs|/qmljs/}
s = File.read(file)
s.scan(/^using namespace (.*);$/) {
ns = $1
t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
before = $1
char = $2
if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
m
else
before + char
end
}
if t != s
puts file
File.open(file, 'w').write(t)
end
}
}
Change-Id: I492792bb9e5655c55795e938031efc557c9a462f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Private plugin are considered those whose name ends with "private".
Avoid being misleading, i.e. do not declare the plugin dump as successful.
Change-Id: Id181d3a09dc9c4895f6566e22ad670435bd5a7f8
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.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>
We use forward slashes in all internal paths, even on Windows.
Change-Id: Ie0b418c770dad96829dd357fe425616b6d3a5b82
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Less typing and less cycles than join(QString) where appropriate
Change-Id: I6ebc0e17e4d7fd9845864dd95b7de4ba4dad6906
Reviewed-by: Eike Ziller <eike.ziller@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>
* better support qbs and similar non QtQuick qml languages
* begin to clean and migrate things from ModelManager to
ModelManagerInterface
Change-Id: Ifa39dc1e4c568e9e21307f4913dcb5989e80420f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>