QWebView problem with flash

  • Hi,
    I had written a music player application in C# and I have decided to rewrite it in QT, but I have a huge problem with QWebView (which is similar to WebBrowser in C#). My application uses a flash player from the website.

    WebBrowser's (C#) WebBrowserProgressChangedEvent sends to me the signal (-1), when the flash player has just finished his job, but QWebView doesn't. In this application I have to know when a current track is finished, to start the next one, so please help me.

    How can I solve this problem?

    I have attached print screens from both applications (they say how WebBrowserProgressChangedEvent (from C#) and loadProgress(int) (from QT) signals are changing) and source code.

    C# application

    QT application

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QtGui/QListWidget>
    #include <QtGui/QVBoxLayout>
    #include <QtGui/QWidget>
    #include <QtWebKit/QWebView>

    class MainWindow : public QWidget

    explicit MainWindow(QWidget *parent = 0);

    QVBoxLayout *verticalLayout;
    QWebView *webView;
    QListWidget *listWidget;

    void setupUi(QWidget *MainWindow);

    private slots:
    void progressChanged(int progress);

    #endif // MAINWINDOW_H@
    @#include "MainWindow.h"

    MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
    connect(webView, SIGNAL(loadProgress(int)), this, SLOT(progressChanged(int)));


    void MainWindow::progressChanged(int progress)

    void MainWindow::setupUi(QWidget *widget)
    webView = new QWebView(widget);
    webView->setFixedSize(250, 70);
    webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

    listWidget = new QListWidget(widget);
    verticalLayout = new QVBoxLayout(widget);


  • If the flash players sends any kind of event you can get from JavaScript, you could add a C++ object to the context and add an event listener calling that object.

    bq. WebBrowser’s (C#) WebBrowserProgressChangedEvent sends to me the signal (-1), when the flash player has just finished his job

    How does that work? You receive the event when the content has finished playing? or finished loading? I guess you could subclass QNetworkAccessManager and wait for all request to be finished.

Log in to reply

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