Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2, 6.2.0 Beta1
-
None
-
Windows 10 Pro x64
Description
Hello, I found a very strange bug. When using QWebEngineView, the transparent background of the MainWindow is filled with black.
Checking how transparency works with WebEngineView:
(5.15.2)
(6.0.2.beta-1)
screen: (black background MainWindow)
console(Crash QWebEngine, but the background has become black anyway):
Source code:
main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.setWindowFlags(Qt::FramelessWindowHint); w.show(); return a.exec(); }
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); setAttribute(Qt::WA_TranslucentBackground); setAutoFillBackground(true); ui->centralwidget->setAttribute(Qt::WA_TranslucentBackground); ui->webEngineView->setAttribute(Qt::WA_TranslucentBackground); ui->webEngineView->setStyleSheet("background:transparent"); ui->webEngineView->page()->setBackgroundColor(Qt::transparent); ui->webEngineView->setUrl(QUrl("https://google.com")); } MainWindow::~MainWindow() { delete ui; }
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
mainwindow.ui
(where the white rectangle is a QWighet converted to a QWebEngineView, and everything else has transparency)
When I deleted this wighet and deleted 4 lines of code( where WebEngineView is present), everything worked for me and it is transparent. Is it possible that this is a bug with QWebEngineView, which for some reason affects the style of the entire MainWindow?
(A screenshot of the fact that transparency works if there is no QWebEngineView, It works perfectly on 5.15.2 and 6.0.2.beta)