THIS BLOG HAS MOVED to unix1.net. This post is now located at https://unix1.net/2012/08/07/how-to-add-qml-module-with-plugins-for-qt-creator/.
However, you will notice that when you do this in Qt Creator
import org.kde.plasma.core 0.1 as PlasmaCore
you will get an underline and the following error
QML module not found
followed by import paths and some vague tip about QML_IMPORT_PATH and importPaths property. What this means is that you need to explicitly declare the import path for KDE components in your *.qmlproject file. Specifically, directly in/under the Project container add the following property
importPaths: [ "/usr/lib64/kde4/imports" ]
or whatever the case is for your specific environment. Now switching back to your .qml file you will notice that the red underline is still there but the message is different when you hover over it
QML module does not contain information contained in plugins
First, the QML can be run at this point. Second, this is because KDE has not included plugins.qmltypes files with their Plasma components. To generate them yourself you can run a command
qmlplugindump org.kde.plasma.core 0.1 /usr/lib64/kde4/imports > /usr/lib64/kde4/imports/org/kde/plasma/plugins.qmltypes
substituting your paths, if different. You’ll note that your user probably doesn’t have privileges to write to that directory – so either run the command as root or generate the file in another directory and then copy it.
After refreshing/reloading the project in Qt Creator you will see the red underline has disappeared and Qt Creator is in a happy state. You can use this method with other components with missing plugins.qmltypes files; and use this with your custom C++ components as well.