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. How to Two overlapping QVideowidgets with transparency
Qt 6.11 is out! See what's new in the release blog

How to Two overlapping QVideowidgets with transparency

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

    Hi,

    I would like to play two videos simultaneously and have the Output mixed. I'm using QT 5.2 on Windows 8.1 with MinGW 4.8. My approach is as follows:

    @ playerA = new QMediaPlayer(this);
    playerB = new QMediaPlayer(this);

    videoWidgetA = new VideoWidget(this);
    playerA->setVideoOutput(videoWidgetA);
    
    videoWidgetB = new VideoWidget(this);
    playerB->setVideoOutput(videoWidgetB);
    
    QBoxLayout *displayLayout = new QHBoxLayout;
    displayLayout->addWidget(videoWidgetA);
    videoWidgetB->setParent(videoWidgetA);
    // Position videoWidgetB that it covers 1/4 of videoWidgetA
    videoWidgetB->setGeometry(0,0,480,270);
    
    displayLayout->setMargin(0);
    setLayout(displayLayout);
    
    playerA->setMedia(QUrl::fromLocalFile("x:/Videos/1.wmv"));
    playerB->setMedia(QUrl::fromLocalFile("x:/Videos/2.wmv"));
    
    videoWidgetB->setWindowOpacity(0.5);
    videoWidgetA->setWindowOpacity(0.5);
    
    playerA->play();
    playerB->play();@
    

    VideoWidgetB opacity is allways 1.0 and VideowidgetA is not visible were videoWidgetB covers the screen, there is no transparency.

    The serious this is if I append

    @ this->setWindowOpacity(0.5);@

    then I can see the desktop through videoWidgetA and videoWidgetB, but not videoWidgetA through videoVidgetB.

    Hope my text is not to confusing.

    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