Results 1 to 2 of 2

Thread: Opening local flash(.swf) file in QtWebKit?

  1. #1

    Default Opening local flash(.swf) file in QtWebKit?

    Hello,

    In my application I have a QWebView where i load a flash (.swf) QUrl.
    load(QUrl("http://www.tizag.com/pics/example.swf"));
    This works very well.

    But when I try to open a flash file locally stored (same file downloaded and stored on the harddrive) it fails. Nothing is displayed.
    load(QUrl("file:///home/moblin/Downloads/example.swf"));

    I have tried modifying setting which could affect this but with no success. Example of these setting are:
    settings()->setAttribute(QWebSettings::LocalContentCanAccessR emoteUrls, true);
    settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
    settings()->setAttribute(QWebSettings::PluginsEnabled, true);


    Have someone experienced this problem before or can give me hints where the fault may be?

  2. #2
    Join Date
    Dec 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Opening local flash(.swf) file in QtWebKit?

    Here is a snippet of code that works on windows and linux that I use for a QGraphicsWebView, where the filename is stored in FlashFile:

    QFileInfo info(FlashFile);
    QString path = info.absolutePath() + "/";
    QString fname = FlashFile;
    fname.remove(path);
    QUrl baseUrl = QUrl::fromLocalFile(path);
    #ifdef Q_OS_LINUX
    QString wmode = "opaque";
    #else
    QString wmode = "transparent"; // works best for windows
    #endif
    QString html = QString("<html><body><embed src='%1' wmode='%2' width=%3 height=%4>"
    "</embed></body></html>").arg(fname).arg(wmode).arg(w).arg(h);
    setHtml(html, baseUrl);

Similar Threads

  1. QDesktopServices open url & local file & pdf or doc
    By patrik08 in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2012, 05:42
  2. QtWebKit and flash performance issues
    By caelestis in forum Qt Programming
    Replies: 0
    Last Post: 7th February 2010, 06:08
  3. Replies: 1
    Last Post: 9th May 2008, 15:49
  4. Password on local file/folder
    By icebox25 in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2007, 17:33
  5. Flash file support in Qt
    By Manjushri.U.G in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2007, 17:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.