Qt 5.0 transparent background QWebView above QWidget with video



  • Hello!

    I can not get a QWebView with a html code to be transparent when it is on top of a QWidget with a video running.

    Any tips to fix that? I found nothing on web and I read something about QGraphicsView but no success at all.

    code:
    @
    int main(int argc, char *argv[]) {

    QApplication app(argc, argv);
    
    QWidget window;
    window.resize(500, 500);
    window.setStyleSheet("background-color: blue;");
    window.setWindowTitle("qt-vlc-webview");
    
    const char* file = "/home/vntsyne/Documents/avatar_60.mkv";
    QVlcPlayer player(&window);
    player.setGeometry(0, 0, 500,500);
    player.playFile(file);
    
    QWebView *view = new QWebView(&window);
    
    QPalette pal = view->palette();
    pal.setBrush(QPalette::Base, Qt::transparent);
    view->page()->setPalette(pal);
    
    view->setStyleSheet("background:transparent;");
    view->setAttribute(Qt::WA_OpaquePaintEvent, false);
    
    view->setHtml("<body >"
                  "<h1 >Test</h1>&lt;/body&gt;");
    
    view->setGeometry(200, 200, 100, 100);
    
    window.show();
    
    return app.exec();
    

    }
    @
    "Screenshot from video:":http://imageshack.us/photo/my-images/707/screenshotfrom201306121.png/
    !http://imageshack.us/photo/my-images/707/screenshotfrom201306121.png/(Qt-vlc-QwebView)!


Log in to reply
 

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