Qt World Summit: Register Today!

Putting another Widget on top of gstreamer stream

  • Hi,

    I have done one simple program to stream rtsp stream using gstreamer and display it on a widget. However, when I place another widget (e.g qpushbutton or qlabel) on top of it. The widgets location will be cut even though I set to transparent. Does any one know how to work about it?

    Below is how I call my code:


        gst_init(&data->count, &data->message);
        WId xwinid = this->winId();
        // prepare the pipeline
        GstElement *pipeline = gst_parse_launch ("playbin uri=rtsp:// latency=10", NULL);
        //this is the call to overlay the gstreamer's output to the Qt Widgets...
        gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline), xwinid);
        // run the pipeline
        GstStateChangeReturn sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
        if (sret == GST_STATE_CHANGE_FAILURE)
            qDebug() << "failed to open..";
          gst_element_set_state (pipeline, GST_STATE_NULL);
          gst_object_unref (pipeline);


        gstreamer = new Gstreamer( this );
        button = new QPushButton( this );
        button->setGeometry(100, 200, 316, 239);
        //button->setStyleSheet( "QPushButton{ background-color: transparent }");
        QPixmap map = QPixmap(QSize(316, 239));
        QPainter mPaintText(&map);
        mPaintText.drawPixmap(0, 0, (316), (239), QPixmap(":/image/Cam selected (frame).png"));
        button->setIconSize(QSize((316), (239)));

    and the Image I got is:

    How do I make the white colour part be able to view the video also? The white portion of the image is already transparent.


  • Lifetime Qt Champion


    From the look of your code, you made map is filled transparent but is your png also transparent ?
    Your button is also not transparent.

  • Hi @SGaist,

    My .png is also transparent expect the border of the image. For my button I have tried setting the button to transparent using setStyleSheet. It is still the same.

Log in to reply