August 31, 2010

archerabi archerabi
Lab Rat
25 posts

[Solved] QdeclarativeImageprovider issues

 

Hello,
i have been trying to use qdeclarative plugin for a while now.I have been following this [doc.trolltech.org].

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 ?

4 replies

August 31, 2010

anselmolsm anselmolsm
Ant Farmer
417 posts

Hi there!

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

$(path_to_Qt_source)/examples/declarative/cppextensions/imageprovider

or online at the Qt git repository [qt.gitorious.org]

Check if you forgot an important step, post here your results =)

 Signature 

Anselmo L. S. Melo (anselmolsm)
www.anselmolsm.org

August 31, 2010

archerabi archerabi
Lab Rat
25 posts

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.
and included

  1. QDeclarativeEngine engine ;
  2. engine.addImageProvider("colors", new ColorImageProvider);

in main.cpp.

I put debug statements in requestPixmap function and found out that the function is never called.

August 31, 2010

archerabi archerabi
Lab Rat
25 posts

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 .

December 1, 2010

zing0000 zing0000
Lab Rat
14 posts

Thanks, save me a lot of work!
and remember to addImageProvider before loading QML source.

 
  ‹‹ qml or c++ or both      fingerPaint App - QTouchEvent example ››

You must log in to post a reply. Not a member yet? Register here!