Qt Creator - Unknown properties with QML plugin



  • Hello,

    I created a QML plugin with a QQuickPaintedItem in it. I very much followed the way of the extending-qml example chapter 6. The item works and I can create a QML application which is using it.

    But I get errors in the code editor in Qt Creator. All properties, not only my custom ones, get "Invalid property name" M16 errors. Autocomplete does also not recognize the properties. But when i set them, e.g. the items color, and run the program, it works and the item has the right color. I have a plugins.qmltypes file in the plugins directory and it seems to be used, since Qt Creator tells me "typeinfo file read" when i hover the mouse over my import statement. In that typeinfo file, everything looks fine. All the properties are listed.

    So why does Qt Creator not recognize them? Is this normal, or have i done something wrong?

    Also I don't get an autocomplete, when i type in the import statement. If i enter import QtQuick, I get an autocomplete list of all sub-modules like QtQuick.Controls, QtQuick.Dialogs or QtQuick.Layouts. But i don't get this when i start entering the name of my QML plugin.

    Thanks for any help.



  • Qt Creator needs a .qmltypes file that can be generated using qmlplugindump.
    For more details have a look here: http://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html



  • @Thomas-Hartmann
    As i stated in my post above " I have a plugins.qmltypes file in the plugins directory and it seems to be used, since Qt Creator tells me "typeinfo file read" when i hover the mouse over my import statement."

    But i still get the errors and no code completion.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.