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

QtBug? QWebView rendering html with flash positioning problem

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.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.
  • J Offline
    J Offline
    JasonKretzer
    wrote on last edited by
    #1

    Background Information
    Using 5.0.2 of Qt
    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://oi41.tinypic.com/r1k194.jpg()!
    @
    #include "mainwindow.h"

    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    {
    //set the main window geometry
    setGeometry(25,25,800,600);

    QPalette p(palette());
    p.setColor(QPalette::Background, Qt::red);
    
    //put a widget out there for contrast
    QWidget * q = new QWidget(this);
    q->setAutoFillBackground(true);
    q->setPalette(p);
    q->setGeometry(50,50, 400,400);
    
    //put another widget out there for further contrast
    QWidget * q2 = new QWidget(q);
    p.setColor(QPalette::Background, Qt::blue);
    q2->setAutoFillBackground(true);
    q2->setPalette(p);
    q2->setGeometry(75,75,200,200);
    
    //this is a QWebView defined in .h
    mWebView = new QWebView(q2);
    p.setColor(QPalette::Background, Qt::green);
    mWebView->setAutoFillBackground(true);
    mWebView->setPalette(p);
    
    //configure the web view
    mWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
    mWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    mWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    
    //read in the resource file that contains the flash
    mWebView->setUrl(QUrl("qrc:/html/flashwrapper.html"));
    mWebView->page()->mainFrame()->load(QUrl("qrc:/html/flashwrapper.html"));
    
    //***** RESIZE AND MOVE DID NOT WORK ******//
    //mWebView->resize(100,100);
    //mWebView->move(20,20);
    
    //ALSO TRIED THE SETGEOMETRY
    mWebView->setGeometry(20,20,100,100);
    

    }

    MainWindow::~MainWindow()
    {

    }
    @

    1 Reply Last reply
    0

    • Login

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