Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
qqworini
Posts: 5
Registered: ‎01-01-2013
My Device: blackberry 10 dev alpha
My Carrier: cmcc

QDeclaretiveImageProvider doesn't work in cascades

Hi Geeks,

 

I tried to port the "Image Provider" example (which can be found in qt documents) to cascades

 

qml usage in Qt Quick :

Image { source: "image://colors/yellow" }
Image { source: "image://colors/red" }

 

c++ code in cascades, add the image provider:

    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    app->setScene(root);
    qml->defaultDeclarativeEngine()->addImageProvider();

 

qml code in Cascades: 

ImageView {
            id: imgView
            imageSource: "image://colors/yellow"
        }

 but debug shows "url failed to load", and nothing appear (blank ImageView)

 

Hope someone can help with this issue :smileyhappy:

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: QDeclaretiveImageProvider doesn't work in cascades

Please use plain text.