Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Putting another Widget on top of gstreamer stream
QtWS25 Last Chance

Putting another Widget on top of gstreamer stream

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
3 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qjqj
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      0
      • SGaistS SGaist

        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.

        Q Offline
        Q Offline
        qjqj
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved