I am trying to get the QWebEngineView to be transparent. I saw things online, but that would make the entire background transparent (IE the window, not the "image"). I am use Qt Designer and Python 3.
If you look at this
you will see that the .png is transparent, but is not showing the default black background (IE would actually be transparent). I have tried to auto-fill the background and use settings such as ".setAttribute(Qt.WA_TranslucentBackground, True)", but again this make the window transparent, not the web page results.
UI file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QWebEngineView" name="webEngineView">
<property name="url">
<url>
<string>http://136.33.26.74/img/Work_In_Progress.png</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QWebEngineView</class>
<extends>QWidget</extends>
<header location="global">QtWebEngineWidgets/QWebEngineView</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Py file:
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5.QtWidgets import QMainWindow, QDialog, QTableWidget, QTableWidgetItem, QListWidget, QListWidgetItem, QLabel, QGraphicsPixmapItem, QDockWidget, QSplashScreen
from PyQt5.QtGui import QPixmap
from PyQt5.QtWebEngineWidgets import QWebEnginePage
from PyQt5.QtWebEngineWidgets import QWebEngineView
import os
import sys
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
uic.loadUi(str(os.getcwd()) + "\\" + 'ui.ui', self)
self.show()
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())
To the person that commented. When I use the same image as you I get .
This is a known bug with QtWebEngine QTBUG-59216