Results 1 to 1 of 1

Thread: Need help with QWebView rendering html with flash positioning problem

  1. #1
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Need help with QWebView rendering html with flash positioning problem

    Background Information
    Using Qt5.0.2
    MainWindow is a QMainWindow
    MainWindow contains 2 QWidgets (q and q2)
    q is red and has q->setGeometry(50,50, 400,400);
    q2 is blue and has q2->setGeometry(75,75,200,200);
    q2 contains a QWebView (mWebView)
    mWebView is green and has mWebView->setGeometry(20,20,100,100);
    mWebView loads an html resource file that has a flash embedded.

    The mWebView is resized, the html file loads, and the flash “plays” just fine.

    The problem is that it plays in the top left corner of MainWindow and will not be moved. If I change the content of the html to just html, it is positioned just fine. However, the flash will only play in the top left.

    Is this a Qt bug? I could really use some help here.

    Here is the code and a screenshot.
    http://i41.tinypic.com/r1k194.jpg also attached to postkitty.PNG

    Qt Code:
    1. #include "mainwindow.h"
    2.  
    3. MainWindow::MainWindow(QWidget *parent)
    4. : QMainWindow(parent)
    5. {
    6. //set the main window geometry
    7. setGeometry(25,25,800,600);
    8.  
    9.  
    10. QPalette p(palette());
    11. p.setColor(QPalette::Background, Qt::red);
    12.  
    13. //put a widget out there for contrast
    14. QWidget * q = new QWidget(this);
    15. q->setAutoFillBackground(true);
    16. q->setPalette(p);
    17. q->setGeometry(50,50, 400,400);
    18.  
    19. //put another widget out there for further contrast
    20. QWidget * q2 = new QWidget(q);
    21. p.setColor(QPalette::Background, Qt::blue);
    22. q2->setAutoFillBackground(true);
    23. q2->setPalette(p);
    24. q2->setGeometry(75,75,200,200);
    25.  
    26. //this is a QWebView defined in .h
    27. mWebView = new QWebView(q2);
    28. p.setColor(QPalette::Background, Qt::green);
    29. mWebView->setAutoFillBackground(true);
    30. mWebView->setPalette(p);
    31.  
    32. //configure the web view
    33. mWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
    34. mWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    35. mWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    36.  
    37. //read in the resource file that contains the flash
    38. mWebView->setUrl(QUrl("qrc:/html/flashwrapper.html"));
    39. mWebView->page()->mainFrame()->load(QUrl("qrc:/html/flashwrapper.html"));
    40.  
    41. //***** RESIZE AND MOVE DID NOT WORK ******//
    42. //mWebView->resize(100,100);
    43. //mWebView->move(20,20);
    44.  
    45. //ALSO TRIED THE SETGEOMETRY
    46. mWebView->setGeometry(20,20,100,100);
    47.  
    48. }
    49.  
    50. MainWindow::~MainWindow()
    51. {
    52.  
    53. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by JasonKretzer; 1st July 2013 at 21:45. Reason: updated contents

Similar Threads

  1. QWebView and Flash Streaming
    By JoeBoggs in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2012, 15:43
  2. QtWebkit - Flash rendering problem
    By rsilva in forum Qt Programming
    Replies: 5
    Last Post: 5th May 2011, 08:38
  3. QWebView + Flash Plugin Problem [ Windows ]
    By rsilva in forum Qt Programming
    Replies: 0
    Last Post: 29th April 2011, 03:35
  4. Replies: 1
    Last Post: 3rd February 2011, 10:38
  5. QWebView problem with flash
    By TuBylem in forum Qt Programming
    Replies: 0
    Last Post: 25th September 2010, 13:10

Tags for this Thread

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.