Custom QML Components don't show in QtCreator Item pane
-
I have install some 3rd party QML components, such as QtDesktop, QMLTemplate and so on. But all the components won't show in the item pane, so I can't drag&drop components.
After tracing the source code of QtCreator, I found that the QML component parser(SubComponentManager) won't add those components into Item library, it passes "false" to the function parseDirectory(), I am confused why it pass false rather than true. Have anybody know about that?subcomponentmanager.cpp line 194
@
foreach (const QString &path, importPaths()) {
url.replace(QLatin1Char('.'), QLatin1Char('/'));
url = path + QLatin1Char('/') + url;
QFileInfo dirInfo = QFileInfo(url);
if (dirInfo.exists() && dirInfo.isDir()) {
//### todo full qualified names QString nameSpace = import.uri();
parseDirectory(dirInfo.canonicalFilePath(), false);
}
}
@[Edit: added @ tags; mlong]
-
The item library is populated by the components of the current projects in by plugins (qtquickplugin, symbianplugin, desktopplugin...).
Since we provide a QtDesktop components plugin you should see the desktop components in the Qt Quick Designer if you import the desktop components in your qml file (import QtDesktop 0.1).
We do not show components if no meta information are present and the import is underlined in the text editor.
-
The Qt Quick Designer needs to know the type/class hierarchy and needs to know the names and types of properties.
-
Hi Thomas, thanks for your response, but I didn't see any cule in the above code show that the problem is due to the lack of meta info:
@parseDirectory(dirInfo.canonicalFilePath(), false);@
It just pass "false", and than the components won't show in the pane, right? -
The SubComponentManager is responsible for handling components which are part of the current project.
Plugins/Components which are installes into Qt are handled by qmlplugindump and the editor's code model.
See: http://doc.qt.nokia.com/qtcreator-2.3/creator-qml-modules-with-plugins.html