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

Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

WebView is not loading anything

Hello, I have created a webview in the main.cpp, but it doesn't any url. Here's my code.


#include <bb/cascades/Application>
#include <bb/cascades/WebView>

#include <QLocale>
#include <QTranslator>
#include "applicationui.hpp"
#include <QDebug>
#include <Qt/qdeclarativedebug.h>
#include <QUrl>
using namespace bb::cascades;

Q_DECL_EXPORT int main(int argc, char **argv)
    Application app(argc, argv);

    new ApplicationUI(&app);

    WebView* page = new WebView();
    qDebug() << page->url(); // result is always QUrl("")

    return Application::exec();

The app does not load (debugging is working, because I tried to set custom html for the webview and it debugs that) and the same behaviour presents when using WebPage class. I really don't understand what I am doing wrong can some help?

Posts: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4

Re: WebView is not loading anything

I thnik, that better option (for beginning) will be QML, but if you want to create controls using only C++, you need to know some details.


Firstly try to use this example (bottom of page, View the C++). You need to create a Page object, because controls cannot be in app without scene.

All time online Smiley Very Happy
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: WebView is not loading anything

Hi daljit97,


You are missing the setSecene command line:





Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: WebView is not loading anything

Thank you, but then it is indispensable to use a Page? What about the WebPage class, I have tried the same thing, but no luck.