Important: Please read the Qt Code of Conduct -

Creating GUI for application working with VLC

  • Sorry for my bad english
    I'm very new to QT. I'm writing an application which using VLC library to play some video content.
    It is quite easy to view video via VLC on QWidget and it's subclasses but I want to make some animated transparent control panel placed over the video. When I placing another QWidget over the video it starts to blink and I also can't find a way to make it transparent.
    So I tried to use QGLWidget. Blink gone but I still can't make it transparent.
    After few days of going around with standard QT's application GUI I found out that I can write it's GUI on QT Quick. I were trying it about 3 days. When creating QTQuick Application I can't find out how to translate vido to some surface from C++ code. When creating QTQuick UI (semi-transparent rectangle) and placing it on QWidget it seems not to be transparent any more.

    Can anyone help me? Where I should implement my GUI and video output surface and how it could be done to achieve my goals?
    Later I can post some source code if anyone need it but I dont think that it would be usefull
    My OS: Windows 8.1, QT Version: 5.3, VLC version: 2.1.3, I'm using QT Creator

  • I don't know much about QGLWidget, but since it inherits QWidget, you could use QGraphicsEffects. I like to use it when making an overlay widget as black transparent backdrop behind a dialog to make them standout in front of the application.

    Create a "QGraphicsOpacityEffect": and set the graphics effect on the QWidget class.

    QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect(this);
    opacityEffect->setOpacity(.5); // value from 0 to 1.0

    You can probably stick with QGLWidget.

  • dvez43,
    Not helped me yet :(
    I'll attach my test project here.
    "Test Project":

  • I apologize, I misunderstood your question. You don't want opacity since it will make the whole window translucent. If you want to overlay a transparent widget over another widget, you can set some window flags and widget attributes on the 'transparent widget' to make the background translucent.

    Try this:
    widget->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint);

    Make sure the widget is up in front as well in front of the VLC widget, you can call show() and raise() on the widget to bring it forward.

    Also, who is the parent of the widget your trying to overlay?

  • Thank you, I'll try this later today.
    But it seems to me that Qt::X11BypassWindowManagerHint will work only on systems with X11 (UNIX?) and will do nothing in Windows, am I not right?

    And about parent of the widget: I've tried 2 ways.
    First - main window as a parent. In this case nothing shown over the video.
    Second - Q[GL]Widget as a parent. In this case overlaying widget shows above the video layer but i can't make it transparent and when it moves by animation ugly artifacts on video appears.

  • If your parent is the main window, you do not need to set the window options to frame-less since it will be embedded right into it.

    set the attribute and call show() and raise() to bring it forward and you should be all set.

  • I've tried everything you wrote above but nothing helped yet.
    I can suggest two things: I'm doing something not right or the problem is in the method VLC translates video to QWidget.
    Can you try to run my test project attached earlier (if you have QT 5.3 installed)?

  • "Here": is an example on how to add transparrent widget on top of video widget. Maybe it will help.

  • andreyc, thank you.
    I thought about this solution (to create a window without frame with a transparent background and synchronize its actions with those of the main window), but gave it up because decided that it was too ugly. Probably it is necessary do so. I'll try and write if I reached my goals.

Log in to reply