QtQuick Desktop components
I try to convert my application to a QtQuick application.
For this I have follow theses steps :
- Download the source code at : http://developer.qt.nokia.com/forums/viewforum/12/
- Add the .h and .cpp to the Visual Studio project
- Add the moc-ing commands to all the .h files
- Add all the generated files to the "Generated Files/..." folders
As you can see I would like to add the qml-desktop-components to my application and not build another dll or something else.
Now, I have a very simple QML window inspired from here : http://labs.qt.nokia.com/2011/08/26/toplevel-windows-and-menus-with-qt-quick/
The source code is simple :
import QtQuick 1.1
import QtDesktop 0.1
title: "TEST APP"
and here the C++ code to display the window :
QDeclarativeView* qdvToolbar = new QDeclarativeView;
But when I execute it, I have the following message in the output :
file:///E://pureStudio/QMLUI/MainWindow.qml:2:1: module "QtDesktop" is not installed
file:///E:/pureStudio/QMLUI/MainWindow.qml:3:1: "content": no such directory
So, first should I use QDeclarativeView to display the window ?
And second, how can I fix my problems ?
The warning about "content - no such directory" is because of the 'import "content"' statement in your QML file. It is attempting to import any .qml files in the given directory (relative-path). Hence, you mustn't have a "content" directory in that path.
The warning about the module not being installed suggests that your import paths are incorrect (or that the module hasn't been installed into the QML_IMPORT_PATH).
If you're using Qt 4.x (ie, QtQuick 1.x), yes, QDeclarativeView is fine. If Qt 5.0 alpha (ie, QtQuick 2.0) then use QQmlView.
But what is a module ? which module ? I have add the qt-components to my project, is it not enough ?
When you do: "import QtDesktop 1.0" you are importing a QML module. The qmldir or library which provides the import must be available in the QML_IMPORT_PATH. Read the documentation on imports for more information on this topic. If you've added the qt-components to your project, and are sure that its being built properly, most likely the output .so isn't in the import path. Or, if they're all just .qml files, it's possible that the qmldir is invalid, or not located in the cwd of the application, for example.
It would be great if you provide some links to the documentation.
Until the final release of Qt5, these links might change as the docteam changes stuff.
The import statement / module definition docs are in the QML documentation as it's a language-specific topic, so see the last link for that one.