How to add qml module with plugins for Qt creator

Source: Internet
Author: User

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

  • Getting started plasma qml tutorial

  • Getting started programming with qml

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 explain icitly 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 supported ded 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.

How to add qml module with plugins for Qt creator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.