Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebView problem with flash
Forum Updated to NodeBB v4.3 + New Features

QWebView problem with flash

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 2 Posters 4.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TuBylem
    wrote on 25 Sept 2010, 18:25 last edited by
    #1

    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
    !http://imageswink.com/out.php/t3493_c-.jpg!:http://imageswink.com/show.php/3493_c-.jpg.html

    QT application
    !http://imageswink.com/out.php/t3494_qt.jpg!:http://imageswink.com/show.php/3494_qt.jpg.html

    MainWindow.h
    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

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

    class MainWindow : public QWidget
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

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

    void setupUi(QWidget *MainWindow);
    

    private slots:
    void progressChanged(int progress);
    };

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

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

    MainWindow::~MainWindow()
    {
    }

    void MainWindow::progressChanged(int progress)
    {
    listWidget->addItem(QString::number(progress));
    }

    void MainWindow::setupUi(QWidget *widget)
    {
    webView = new QWebView(widget);
    webView->setFixedSize(250, 70);
    webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    webView->setUrl(QUrl("http://w618.wrzuta.pl/audio.swf?key=aL9BKZ2y9Lb&host=wrzuta.pl&autoplay=y"));

    listWidget = new QListWidget(widget);
    
    verticalLayout = new QVBoxLayout(widget);
    verticalLayout->addWidget(webView);
    verticalLayout->addWidget(listWidget);
    
    widget->setLayout(verticalLayout);
    

    }@

    1 Reply Last reply
    0
    • B Offline
      B Offline
      benjamin.poulain
      wrote on 25 Sept 2010, 21:41 last edited by
      #2

      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.

      1 Reply Last reply
      0

      1/2

      25 Sept 2010, 18:25

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved