From 7e238f69b09d5768677443b37223d5f77a0e19ed Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 10 Oct 2015 00:12:14 +0200 Subject: [PATCH] WebInspector: Fix close button with QtWebEngine 5.6 --- src/lib/webengine/webinspector.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/webengine/webinspector.cpp b/src/lib/webengine/webinspector.cpp index fce118836..5a52b86d4 100644 --- a/src/lib/webengine/webinspector.cpp +++ b/src/lib/webengine/webinspector.cpp @@ -81,11 +81,17 @@ void WebInspector::unregisterView(QWebEngineView *view) void WebInspector::updateCloseButton() { - page()->runJavaScript(QL1S("var button = document.getElementsByClassName('toolbar-close-button-item')[0];" - "button.style.display = 'inline-block';" + page()->runJavaScript(QL1S("var toolbar = document.getElementsByClassName('inspector-view-toolbar')[1];" + "var button = document.createElement('button');" + "button.style.width = '26px';" + "button.style.height = '26px';" + "button.style.border = 'none';" + "button.style.background = 'url(qrc:html/close.png) no-repeat';" + "button.style.backgroundPosition = 'center center';" "button.addEventListener('click', function() {" " window.close();" - "})")); + "});" + "toolbar.appendChild(button);")); } void WebInspector::keyPressEvent(QKeyEvent *event)