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:

    gstreamer.cpp

        gst_init(&data->count, &data->message);
    
        WId xwinid = this->winId();
        // prepare the pipeline
        GstElement *pipeline = gst_parse_launch ("playbin uri=rtsp://192.168.3.123 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);
        }
    

    mainwindow.cpp

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

    and the Image I got is:
    0_1563285906938_photo.png

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

    Thanks!


  • Lifetime Qt Champion

    Hi,

    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.


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.