Strange behavior: QWebView with QCoreApplication and QApplication



  • Hallo,

    i am new to QT and don't understand the following behavior:

    When i use the following code to display a HTML-GUI the "Browser-App" is not able to display images:
    @
    #include <QtGui>
    #include <QWebView>
    #include <QGraphicsWebView>
    #include <iostream>

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

    QStringList args = app.arguments();
    if (args.count() != 2)
    {
    std::cerr << "pass the URL please\n" << endl;
    return 1;
    }

    QWebView view;
    view.load(QUrl(args[1]));
    view.setWindowFlags(Qt::FramelessWindowHint);
    view.showMaximized();
    view.show();
    return app.exec();
    }
    @

    Then i changed the Code and add this 3 Lines direct after "QApplication app(argc, argv);"

    @
    QCoreApplication::setOrganizationName(QLatin1String("Qt"));
    QCoreApplication::setApplicationName(QLatin1String("demobrowser"));
    QCoreApplication::setApplicationVersion(QLatin1String("0.1"));
    @

    And the images are displayed !
    What is the reason for that?
    Also it is strange, that i have to leave the values as they are.
    Changing "0.1" or "demobrowser" to something else results in not displaying the images!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.