My goal is to make the background of a QWebView
element transparent.
+---------------------------+
| x | Window title | <<< Hidden borders and title bar
+---------------------------+ view->setWindowFlags(Qt::FramelessWindowHint);
| |
| ****************** |
| ********************<--|------- This is the HTML side (a rectangle with
| ****************** | rounded corners)
| <-|-- with transparent background that must
+---------------------------+ remain transparent for the desktop window
I have researched how to set a transparent background for the webview and came across this code snippet:
QPalette pal = view->palette();
pal.setBrush(QPalette::Base, Qt::transparent);
view->page()->setPalette(pal);
view->setAttribute(Qt::WA_OpaquePaintEvent, false);
Unfortunately, the above code is not working as intended. Here is how my window currently appears:
The issue lies in the gray part needing to be transparent. How can I resolve this?
I am using the following code to remove window decorations.
view->setWindowFlags(Qt::FramelessWindowHint);