Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.15.2, 5.15.6, 6.2.0
-
None
Description
QWebEngineView with transparent bg always on top. I want to display the QWidget overlay and QPushButton button on the QWebEngineView.
If I set "view.page()->setBackgroundColor(Qt::transparent);", the overlapping area of QWidget and QPushButton to QWebEngineView cannot be displayed.
If I don't set "view.page()->setBackgroundColor(Qt::transparent);", I can display the overlapping area of QWidget and QPushButton to QWebEngineView.
//代码占位符 int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow mainWindow; QWebEngineView *view = new QWebEngineView(&mainWindow); view->setGeometry(50, 50, 300, 300); view->setHtml("<html><head><style>" "h1 {background-color: #00ff00;}</style></head>" "<body><h1>This is heading 1</h1></body></html>", QUrl("http://localhost")); view->page()->setBackgroundColor(Qt::transparent); QWidget overlay(&mainWindow); overlay.setGeometry(0, 0, 100, 100); overlay.raise(); overlay.setStyleSheet("background:red"); QPushButton button(&mainWindow); button.setGeometry(100, 0, 100, 100); button.setText("button"); mainWindow.resize(400, 400); mainWindow.show(); QObject::connect(&button, &QPushButton::clicked, [ = ]() { static bool transparent = false; view->page()->setBackgroundColor(transparent ? Qt::transparent : Qt::white); transparent = !transparent; }); return app.exec(); }
Attachments
Issue Links
- duplicates
-
QTBUG-70200 QWebEngineView overlap QWidget if page backgroundColor set to transparent
- Closed
-
QTBUG-94132 QWebEngine with transparent properties, other QWidget and QPushButton cannot be rendered
- Closed
- is duplicated by
-
QTBUG-94165 QWebEngine with transparent properties, always on top. other QWidget and QPushButton cannot be rendered
- Closed