After reading this discussion: Draw on top of xoverlay using Qt I've ended up with this code:
class Player : public QGst::Ui::VideoWidget { ... }
void Player::play() {
QGst::PipelinePtr pipeline = QGst::ElementFactory::make("playbin2").dynamicCast<QGst::Pipeline>();
watchPipeline(pipeline);
pipeline->setProperty("uri", "/path/to/my/video.mp4");
QGst::BusPtr bus = pipeline->bus();
bus->addSignalWatch();
QGlib::connect(bus, "message", this, &Player::onBusMessage);
pipeline->setState(QGst::StatePlaying);
}
So I have my video playing in this QWidget
. Now I want to add another QWidget
on top of this one to draw something or to place another QWidget
with alpha blending. I tried this code in the main app:
Player *player = new Player(this);
QWidget *videoOverlay = new QWidget(player);
// set the videoOverlay geometry
videoOverlay->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
videoOverlay->setAttribute(Qt::WA_TranslucentBackground);
But I get a black opaque QWidget
. There is no transparency at all.
What am I missing?