emolaus
emolaus

Reputation: 599

I can't get qml to use my custom plugin

I'm working in QtQuick and right now struggling with a weird problem: I can't get my custom plugin to work in Qml. There's a simple demo in the SDK (Examples/4.7/declarative/tutorials/extending/chapter6-plugins) and this doesn't work on my computer either. I don't get any error messages except that it doesn't recognize my custom items. Has anybody seen this problem? Any suggestions?

My setup: Win 7 Home Premium, Qt Creator 2.1.0, Qt 4.7.3 (MinGW 4.4)

Thanks

Upvotes: 2

Views: 3852

Answers (3)

LarissaGodzilla
LarissaGodzilla

Reputation: 630

I just had the exact same problem. Build your .dlls as release instead of debug, that fixed it for me.

Upvotes: 0

Marco
Marco

Reputation: 2190

Beside the qmldir issue already mentioned by blakharaz, also make sure to set QML_IMPORT_PATH in your pro file or setting the path via QDeclarativeEngine::addImportPath() so the module can be found on your development environment (if you don't install them systemwide before using).

And when using subfolders, make sure they are part of the import (see http://doc.qt.nokia.com/4.7-snapshot/qdeclarativemodules.html)

Upvotes: 2

blakharaz
blakharaz

Reputation: 2590

It would be nice to have some code. One possible issue could be the directory structure or the qmldir file. If you want to have a plugin called Foo you basically need a directory Foo which contains the Foo.dll (or libFoo.so) and a qmldir file (content is at least "plugin Foo") If you have that "import Foo 1.0" should load the library.

Upvotes: 0

Related Questions