How To Add QML Module with Plugins for Qt Creator
I decided to take a plunge into a KDE Plasma development with a simple plasmoid with Qt Creator. There’s a very good overview and a guide
However, you will notice that when you do this in Qt Creator
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
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
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.
Do you have an idea why qmlplugindump doesn’t work on kde5 framework? (Plasma 5)
I tried qmlplugindump on /usr/lib/x86-64/qt5/qml/. Is that right import dir for plasma 5 ?