[Solved] QdeclarativeImageprovider issues
i have been trying to use qdeclarative plugin for a while now.I have been following "this":http://doc.trolltech.org/4.7-snapshot/qdeclarativeimageprovider.html.
I am trying to use it in my mainwindow.cpp class but i always get a runtime warning saying
QML Image: Failed to get image from provider: image://colors/red
QML Image: Failed to get image from provider: image://colors/yellow
Any suggestions ?
Hm... besides the obvious ('there is something wrong in you provider'), I can point you one of the Qt examples that shows QDeclarativeImageProvider in action. You can find it in
or "online at the Qt git repository":http://qt.gitorious.org/qt/qt/trees/4.7/examples/declarative/cppextensions/imageprovider
Check if you forgot an important step, post here your results =)
thats exactly the example i am using...except instead of using it as a plugin i am trying to use it in main.cpp.
I have commented out the QDeclarativeExtensionPlugin.
QDeclarativeEngine engine ;
engine.addImageProvider("colors", new ColorImageProvider);
I put debug statements in requestPixmap function and found out that the function is never called.
It was a silly mistake on my side.
I was using a random Engine when instead i should have been using the engine from the QDecalrativeview .
Thanks, save me a lot of work!
and remember to addImageProvider before loading QML source.