Qt Widgets + GStreamer + Overlay + Screen Capture
-
@JoeCFD Thank you for the suggestion! Unfortunately, it gave me the same result. I specifically changed the overlay code to be this:
class OverlayWidget : public QLabel { Q_OBJECT public: OverlayWidget(QWidget* parent) : QLabel(parent) { // setAttribute(Qt::WA_TranslucentBackground); // setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); setStyleSheet("background-color: transparent"); }
Is this what you were suggesting?
-
@SeeRich Yes, something like that. Can you try
setStyleSheet("background-color: green");
to see if the background color is green?if the green color works, try the following:
QLabel * _overlayLabel{nullptr}; /* no need to create a overlay widget class */
_overlayLabel = new Qlabel( this );
_overlayLabel->setStyleSheet("border:none; background:transparent;"); -
@SeeRich your mainwindow has a black background stylesheet which affects its children. Assign its object name to its stylesheet and its children will not be affected anymore.
MainWindow() { resize(720, 600); setAttribute(Qt::WA_StyledBackground); setObjectName( "mainWindiw" ); setStyleSheet( QString( "MainWindow#%1 { background-color: black; }" ) .arg( objectName() );
-
@SeeRich Change the background-color to blue to make sure the color from mainwindow stylesheet
MainWindow() { resize(720, 600); setAttribute(Qt::WA_StyledBackground); setObjectName( "mainWindow" ); setStyleSheet( QString( "MainWindow#%1 { background-color: blue; }" ) .arg( objectName() );
also try the following:
_overlayLabel = new Qlabel( this ); _overlayLabel->setAttribute(Qt::WA_StyledBackground); _overlayLabel->setStyleSheet("border:none; background:transparent;");
-
@SeeRich
can you changesetAttribute(Qt::WA_StyledBackground); setObjectName( "mainWindow" ); setStyleSheet( QString( "MainWindow#%1 { background-color: blue; }" ) .arg( objectName() );
to
setAttribute(Qt::WA_StyledBackground); setObjectName( "mainWindow" ); setStyleSheet( QString( "QWidget#%1 { background-color: blue; }" ) .arg( objectName() );
there is no MainWindow stylesheet. It should be QMainWindow.