summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2015-04-24 14:32:43 +0300
committerBogDan Vatra <bogdan@kde.org>2015-05-28 06:17:58 +0000
commit28d2b1616541eee4ab0e06e89c7e8cab04bd9961 (patch)
treeb0b5bc882aab83340ae2e14f51e35d0d49bf35b1 /tests
parent83fc8e1fd30bf545f6f3d49200e554d95a4ee947 (diff)
downloadqt-creator-28d2b1616541eee4ab0e06e89c7e8cab04bd9961.tar.gz
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/codemodel/importscheck/importscheck.pro2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qml/codemodel/importscheck/importscheck.pro b/tests/auto/qml/codemodel/importscheck/importscheck.pro
index b36550a10a..2821fb95ef 100644
--- a/tests/auto/qml/codemodel/importscheck/importscheck.pro
+++ b/tests/auto/qml/codemodel/importscheck/importscheck.pro
@@ -1,4 +1,4 @@
-QTC_LIB_DEPENDS += cplusplus utils
+QTC_LIB_DEPENDS += cplusplus utils extensionsystem
include(../../../qttest.pri)
include($$IDE_SOURCE_TREE/src/rpath.pri)
DEFINES += QMLJS_BUILD_DIR