×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    15

    How to start browser and load url in symbian s60 QT app?

    Hello!

    I just want my app to start a browser and load an URL. I am using this code that compiles and runs on simulator, but when started, nothing happens.

    #include <QtGui>
    #include <QDesktopServices>
    #include <QUrl>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QDesktopServices:penUrl(QUrl("http://www.google.com"));
    return app.exec();
    }

    Is it possible that there is something missing in my simulator ( e.g browser), because i can't move through menus or do anything else (no menu at all). I have only installed Nokia QT SDK (read this tutorial http://wiki.forum.nokia.com/index.ph...r_With_Symbian).
    Do i need to install something else to use all the functions of the simulated phone (sms, contacts, browser...) or is my code wrong?

    Thank you.
    Last edited by DixieFlatline; 2011-01-22 at 09:35.

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

    Re: How to start browser and load url in symbian s60 QT app?

    Qt Simulator doesn't really have a browser. Test it either on desktop or on the real phone.
    Also note that your application has no UI and enters event loop, so it will be difficult to close it.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    15

    Re: How to start browser and load url in symbian s60 QT app?

    Tnx for your quick answer. I will test it on a device when i get it.
    What do you mean by event loop? Do i have to add some kind of exit button to prevent this?

    Is this better (shows exit button in simulator):

    #include <QtGui>
    #include <QDesktopServices>
    #include <QUrl>
    #include <QtGui/QApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QDesktopServices:penUrl(QUrl("http://www.google.com"));

    MainWindow w;
    #if defined(Q_WS_S60)
    w.showMaximized();
    #else
    w.show();
    #endif

    return app.exec();
    }
    Last edited by DixieFlatline; 2011-01-22 at 11:27.

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

    Re: How to start browser and load url in symbian s60 QT app?

    QApplication::exec() starts an event loop.
    http://doc.qt.nokia.com/4.7/qapplication.html#exec

  5. #5
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    142

    Re: How to start browser and load url in symbian s60 QT app?

    If you just want to open a link, when you app is launched(and not want to show any user interface). Just open the link and exit your application. Do not keep your application running unnecessarily.
    Do like this:

    Code:
    #include <QtGui>
    #include <QDesktopServices>
    #include <QUrl>
    
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    
    QDesktopServices:openUrl(QUrl("http://www.google.com"));
    return 0;
    }

  6. #6
    Registered User
    Join Date
    Aug 2010
    Posts
    15

    Re: How to start browser and load url in symbian s60 QT app?

    Tnx for the tip.

Similar Threads

  1. How to change Symbian app name and version in Qt Creator?
    By Sasler in forum [Archived] Qt SDKs and Tools
    Replies: 8
    Last Post: 2011-12-21, 11:17
  2. Replies: 1
    Last Post: 2007-04-30, 10:42
  3. Replies: 1
    Last Post: 2003-12-01, 14:17

Posting Permissions

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