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
Highlighted
Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

[ Edited ]

- Existing application written for 10.0.6

- Installed 10.0.9 SDK

- Read:

  https://developer.blackberry.com/cascades/documentation/dev/upgrading/applicationchanges.html

- Now have:

 

 

	Model *model = new Model();

	QmlDocument *qml = QmlDocument::create("asset:///main.qml")
	   .property("cs", this)
	   .property("model", model);

	   if (!qml->hasErrors()) {
	       Page *page= qml->createRootObject<Page>();
	       if (page) {
	           setScene(page);
	       }
	   }

 

In my toolbar, "BlackBerry 10 Native SDK 10.0.9.386" is selected.

 

The line:

 

Page *page= qml->createRootObject<Page>();

 

... is underlined in red with the error:

 

no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

 

Previous to this, there was a line underlined in red in one of my .h files that that was complaining about an SQL related issue, but the line had nothing at all to do with SQL. I did a clean in the IDE and that went away fortunately.

Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

createRootObject is a template function, so it needs to be qml->createRootObject<Page>()

Like all of my posts
Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

[ Edited ]

The forum ate the <Page> substring in that line of code... it must have interpted it as HTML. (fixed my above post)

 

I am calling it as you suggest and that is what is resulting in the error.

Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

Are you using the right namespace? bb::cascades and make sure you import <bb/cascades/Page>

Like all of my posts
Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: no matching function for call to 'bb::cascades::QmlDocument::createRootObject()'

Thanks Kyle, that was the primary issue.

 

The other problem is that RIM's demo code is strangely wrong: (https://developer.blackberry.com/cascades/documentation/dev/upgrading/applicationchanges.html)

 

setScene(page);

 

Should now be:

 

Application::instance()->setScene(page);

 

Kind of silly that the very page that shows you how things are supposed to work now contains code lower down that isn't consistent with what it preaches up top. Sigh.