Important: Please read the Qt Code of Conduct -

VideoWidget Video With Transparent Background

  • I am working on a little game,
    and sofar it's going good

    I have some short videos and some parts of them are transparent,
    basically I am talking about effects like blood, dust, fog, sparkle etc. already prekeyed.

    I wanted to use the VideoWidget to show them,
    its working if I set up like this, the problem is that the Widget background is not transparent.

    It's black.

    If I use a label and adding a .gif file, it is transparent,
    this is what I want but I cannot use .gif file because the quality is too poor.

    @ Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
    Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
    Phonon::createPath(mediaObject, videoWidget);

    Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::createPath(mediaObject, audioOutput);

    QString ss2 = "Arrow_01.avi";


    if I try like this its also not working

    @ videoWidget->setAttribute(Qt::WA_TranslucentBackground);

  • has no one an idea?

    Or can you tell me if there are other options to display videos,
    using maybe external plugins??

  • hmm after hours and hours of desperating trying,
    I finally figured something out that seems to be a adequate solution.

    I converted my visual effect video into a .png sequence.
    then I used a normal Widget and set the background image to the first .png file of the sequence.

    then I connected a timer to this function and a counter is moving to the next picture.

    @ movie_name_int++;
    movie_name_string="background-image: url(png_sequence/";
    ui.widget_2->setStyleSheet(movie_name_string );@

    It works pretty good, but I dont know about the performance, if I am gonna use this often.

    I am happy I can finally continue
    Merry Christmas

Log in to reply