From 3fdcc80a11bb5320e85cf37e0bfd89cce01e296b Mon Sep 17 00:00:00 2001
From: Peter Varga <pvarga@inf.u-szeged.hu>
Date: Thu, 20 Jul 2017 15:21:07 +0200
Subject: [PATCH] Fix viewport information in simplebrowser

Resize QWebEngineView explicitly as a workaround for background tabs.

Task-number: QTBUG-61770
Change-Id: Iaa792cb01788c9c33b6992a08a05b0cf11d0579d
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
---
 examples/webenginewidgets/simplebrowser/tabwidget.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.cpp b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
index a7f855c2a..33c3ac1dc 100644
--- a/examples/webenginewidgets/simplebrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
@@ -204,8 +204,13 @@ WebView *TabWidget::createTab(bool makeCurrent)
     webView->setPage(webPage);
     setupView(webView);
     addTab(webView, tr("(Untitled)"));
-    if (makeCurrent)
+    if (makeCurrent) {
         setCurrentWidget(webView);
+    } else {
+        // Workaround for QTBUG-61770
+        webView->resize(currentWidget()->size());
+        webView->show();
+    }
     return webView;
 }
 
-- 
GitLab