×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Problems porting WRT widget to Qt

    I tried to port my WRT widget to run on QWebKit following this tutorial: http://wiki.forum.nokia.com/index.ph...t_applications

    However, the simulator as well as my device (N97) shows only blank screen when running the app. I have removed all WRT dependencies (widget, device, etc.) from my widget by overwriting them with dummy JavaScript objects and functions.

    Also replacing
    Code:
    view->load(QUrl("qrc:/Main.html"));
    with e.g.
    Code:
    view->load(QUrl("http://www.google.fi"));
    did not help anything, it still shows just blank.

    Do I need to trigger some function after calling QWebView::load(...) or should it show content automatically after that?

    I have ensured that the qrc file is built correctly with my widget files. The code on Qt-side is exactly the same than in the tutorial.

    Is the tutorial or its example code outdated or what might be wrong in my code? At least creating the project with the latest Qt Creator is slightly different from the tutorial steps - to be precise, there is no option to select QtWebKit module for the project. I added it manually to pro-file:
    Code:
    QT       += core gui webkit
    My Qt version is 4.6.3 and Qt Creator version is 2.0.0.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    Test application:
    Code:
    #include <QtGui>
    #include <QtWebKit>
    
    int main(int argc, char * argv[])
    {
        QApplication app(argc, argv);
    
        QWebView view;
        view.load(QUrl("http://www.google.fi"));
        view.show();
    
        return app.exec();
    }
    Make sure that you are not behind a firewall.

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Problems porting WRT widget to Qt

    i got similar problem some weeks ago ...blank page on symbian device after load ...
    so far as i tried HttpClient example also do not connect to internet while FtpClient connects ok ... in fact there are some different details in both .pro and also in cpp code

    My hint is to use that sample as starting point ...try to add a QWebView on FTPClient sample and it should work fine
    Last edited by lucarocchi; 2010-09-03 at 19:01.

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    Thanks for answers so far. Problem not yet solved, however.

    divanov: I tried this without success. On PC I'm behind corporate firewall but I also ran the program on N97 without proxy and the webview still stayed blank. No connection was asked or established.

    lucarocchi: The example projects included in Qt Creator do not build with my configuration - I have understood from forums that there are problems with them on Windows 7. However, there are no such problems when creating new project.

    I tried showing some static html on webview which indeed worked as expected - the text 'Foo' was shown on white background:

    Code:
    #include <QtGui>
    #include <QtWebKit>
    
    int main(int argc, char * argv[])
    {
        QApplication app(argc, argv);
    
        QWebView view;
        QString html = "<html>";
        html.append("<head><title>Test</title></head>");
        html.append("<body>Foo</body>");
        html.append("</html>");
        view.setHtml(html, QUrl("http://foo.bar/biz"));
        view.show();
    
        return app.exec();
    }
    Any further help with QWebView::load(...) ?

    edit: I noticed that I forgot to call QWebView::show() after calling load(). Blank screen still there however.
    Last edited by mauso; 2010-09-10 at 12:36.

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    Quote Originally Posted by mauso View Post
    I tried this without success. On PC I'm behind corporate firewall but I also ran the program on N97 without proxy and the webview still stayed blank. No connection was asked or established.
    Note that on Symbian you need NetworkServices capability and behind firewall you need something like this:
    Code:
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName("proxy.xxx.com");
    proxy.setPort(8080);
    QNetworkProxy::setApplicationProxy(proxy);

  6. #6
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    Thanks for quick reply! I set the NetworkServices and a bunch of other capas allowed for self-signed apps. I tried to load both google URL and my own html-file via qrc. I also modified the html so that it contained hardly anything but <body>Foo</body> and other mandatory tags. Still blank webview. Maybe better to zip and upload whole project here so you can check if anything is wrong in configuration or code.

    Maybe I try if setting proxy helps on Simulator but it doesn't help much anyway if I can't finally get it work on device that doesn't use proxy.

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    Quote Originally Posted by mauso View Post
    Maybe better to zip and upload whole project here so you can check if anything is wrong in configuration or code.
    If even primitive test application doesn't work for you, then there is something wrong with your system setup.

  8. #8
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    How come that the static html works with QWebView::setHtml(...) ? The problem seems to come when using the QWebView::load() function. Anyhow, I uploaded my project zipped here: http://bit.ly/aAfKwg

  9. #9
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    Code:
    $ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -o webviewtest.o webviewtest.cpp
    webviewtest.cpp:1:25: error: WebviewTest.h: No such file or directory
    webviewtest.cpp:7: error: ‘WebviewTest’ has not been declared
    webviewtest.cpp:7: error: ISO C++ forbids declaration of ‘WebviewTest’ with no type
    webviewtest.cpp: In function ‘int WebviewTest(QWidget*)’:
    webviewtest.cpp:8: error: only constructors take base initializers
    webviewtest.cpp:10: error: ‘setupUI’ was not declared in this scope
    webviewtest.cpp:11: warning: no return statement in function returning non-void
    webviewtest.cpp: At global scope:
    webviewtest.cpp:13: error: expected constructor, destructor, or type conversion before ‘::’ token
    webviewtest.cpp:18: error: ‘WebviewTest’ is not a class or namespace
    webviewtest.cpp: In function ‘void setupUI()’:
    webviewtest.cpp:20: error: invalid use of ‘this’ in non-member function
    webviewtest.cpp:21: error: ‘setCentralWidget’ was not declared in this scope
    webviewtest.cpp:26: error: ‘webView’ was not declared in this scope
    webviewtest.cpp:26: error: ‘createWebView’ was not declared in this scope
    webviewtest.cpp: At global scope:
    webviewtest.cpp:30: error: ‘WebviewTest’ is not a class or namespace
    webviewtest.cpp: In function ‘QWebView* createWebView()’:
    webviewtest.cpp:32: error: invalid use of ‘this’ in non-member function
    make: *** [webviewtest.o] Error 1

  10. #10
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    This is quite exciting as my build chain gives no errors, even after running clean and deleting the WebviewTest-simulator-build folder, or when creating all new project with the sources. We might use different development environments or something?

    Here's my output in Qt Creator, building for Simulator debug target: http://pastebin.com/xJ56AhG0
    And for S60 5th ed SDK 1.0 debug target: http://pastebin.com/fE7BNkxX

  11. #11
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    FYI, Unix systems have case-sensitive file names.

  12. #12
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    Sorry about that, corrected zip now in the same URL, http://bit.ly/aAfKwg . Is there an irc channel to continue discussion? Maybe better to just post here the outcome to this problem once it has been resolved.

  13. #13
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    Again, you have
    #include "WebviewTest.h"
    However, there is only webviewtest.h file, which is not the same file on Unix systems.

  14. #14
    Registered User
    Join Date
    Feb 2009
    Posts
    40

    Re: Problems porting WRT widget to Qt

    I rechecked the zip by downloading it from the link and didn't find any references to WebviewTest.h - did you use the updated zip?

  15. #15
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problems porting WRT widget to Qt

    You should use
    Code:
    view->load(QUrl("qrc:web-content/main.html"));
    instead of
    Code:
    view->load(QUrl("qrc:/main.html"));
    Because you have defined your resources like this
    Code:
    <RCC>
        <qresource prefix="/">
            <file>web-content/main.html</file>
        </qresource>
    </RCC>

Similar Threads

  1. chracter wrapping problems in qt widget
    By sk.panda in forum Qt
    Replies: 6
    Last Post: 2010-07-16, 15:36
  2. Replies: 1
    Last Post: 2009-12-20, 05:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×