Commit Graph

4 Commits

Author SHA1 Message Date
Tim Jenssen
1898ba5ad3 make library defines more consistency
Change-Id: I211d511667d5b9c8f518bfbe750aca4483baff62
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-12-12 14:48:34 +00:00
Marco Benelli
86bca29f36 Fixed QT variable value in importscheck.pro .
It now use the 'qml' feature instead of the deprecated 'script'

Change-Id: Ie2e4148e586503be11d233b7f544cf4f3c040bdb
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-09-01 14:49:38 +00:00
BogDan Vatra
28d2b16165 Allow plugins to insert custom imports.
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>
2015-05-28 06:17:58 +00:00
Fawzi Mohamed
d90bd09499 qmljs: tests of the import architecture
First tests using the new qmljs testing architecture

Change-Id: Id88fe53dddbb720c56cd0473e74f476862feb803
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2014-07-30 15:07:50 +02:00