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. Qt 5.0 transparent background QWebView above QWidget with video
Forum Updated to NodeBB v4.3 + New Features

Qt 5.0 transparent background QWebView above QWidget with video

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

    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)!

    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