B
B
bfDeveloper2011-07-06 15:56:26
Qt
bfDeveloper, 2011-07-06 15:56:26

Qt AutoFillBackGround and translucent window?

Let's start with the fact that I use mplayer to play videos in my application. A process is created, the winId of the widget on which the video is played is indicated. In order for the picture to show, I set AutoFillBackground to true. All this works as it should. I use mplayer because Phonon didn't want to play *.avs files with any backend (even mplayer). And mplayer plays by itself.
Now I needed to make a window in the form of a picture with translucency. It works like this:

MainWindow mw;
    QPixmap img(":/win.png");

    mw.setPixmap(img);
    mw.setMask(img.mask());
    mw.resize(1280, 1050);

    mw.setAttribute(Qt::WA_TranslucentBackground);
    mw.setWindowFlags(Qt::FramelessWindowHint);

The problem arose when adding my widget with mplayer'om to this curly window. The sound is played, there is no picture. Mplayer does not give any errors to the console.
If you add mw.setAutoFillBackground(true), then the picture appears, but the translucency disappears, they are filled with the standard color of the window. If it sets the Palette window with a transparent color, then the video stops playing.
OS Windows 7 32-bit.
I start mplayer like this: mplayer -vo direct3d -slave -wid<MPlayerWidget->winId()> filename
How do I make mplayer draw on a transparent window?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bfDeveloper, 2011-07-07
@bfDeveloper

I solved the problem by making a separate window for the player (top-level widget). I had to track the movement of the main window and move the player behind it, but everything works fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question