From 1b065b291ece9e1228773544633cc21dd0bb4674 Mon Sep 17 00:00:00 2001
From: Pierre Rossi <pierre.rossi@digia.com>
Date: Tue, 18 Jun 2013 08:59:24 +0200
Subject: [PATCH] cleaner content margins for the nested layouts

also remove QQUICKWEBENGINE env var
---
 examples/widgets/widgetwindow.cpp |  6 +++++-
 lib/qwebcontentsview.cpp          |  1 +
 shared/native_view_container_qt.h | 10 +++++++---
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/examples/widgets/widgetwindow.cpp b/examples/widgets/widgetwindow.cpp
index 159952715..2cf2cfddd 100644
--- a/examples/widgets/widgetwindow.cpp
+++ b/examples/widgets/widgetwindow.cpp
@@ -43,6 +43,8 @@
 
 #include "qwebcontentsview.h"
 
+static const int margin = 1;
+
 WidgetWindow::WidgetWindow()
 : m_webView(new QWebContentsView)
 , addressLineEdit(0)
@@ -51,12 +53,14 @@ WidgetWindow::WidgetWindow()
     if (QIcon::themeName().isEmpty())
       QIcon::setThemeName("oxygen");
 
-    setGeometry(0, 0, 1024, 768);
+    setGeometry(0, 0, 800, 600);
 
     QVBoxLayout* layout = new QVBoxLayout;
+    layout->setContentsMargins(margin, margin, margin, margin);
 
     // Create a widget based address bar.
     QHBoxLayout* addressBar = new QHBoxLayout;
+    addressBar->setSpacing(margin); // Bigger buttons, less space between them
 
     QToolButton* backButton = new QToolButton;
     backButton->setIcon(QIcon::fromTheme("go-previous"));
diff --git a/lib/qwebcontentsview.cpp b/lib/qwebcontentsview.cpp
index 5cff52ad4..3da4c727e 100644
--- a/lib/qwebcontentsview.cpp
+++ b/lib/qwebcontentsview.cpp
@@ -71,6 +71,7 @@ QWebContentsView::QWebContentsView()
     content::BrowserContext* browser_context = static_cast<ContentBrowserClientQt*>(content::GetContentClient()->browser())->browser_context();
     d->webContentsDelegate.reset(WebContentsDelegateQt::CreateNewWindow(browser_context, NULL, MSG_ROUTING_NONE, gfx::Size()));
     QVBoxLayout *layout = new QVBoxLayout;
+    layout->setContentsMargins(0, 0, 0, 0);
     setLayout(layout);
 
     WebContentsViewQt* content_view = static_cast<WebContentsViewQt*>(d->webContentsDelegate->web_contents()->GetView());
diff --git a/shared/native_view_container_qt.h b/shared/native_view_container_qt.h
index fbb29ee85..ce977ac19 100644
--- a/shared/native_view_container_qt.h
+++ b/shared/native_view_container_qt.h
@@ -15,7 +15,7 @@ public:
         : m_embeddable(0)
         , m_currentQQuickNativeView(0)
         , m_currentQWidgetNativeView(0)
-        , m_isQQuick(!qgetenv("QQUICKWEBENGINE").isNull())
+        , m_isQQuick(true)
     {
     }
 
@@ -34,8 +34,12 @@ public:
 
     QVBoxLayout* widget()
     {
-        if (!m_embeddable)
-            m_embeddable = new QVBoxLayout;
+        if (!m_embeddable) {
+            m_isQQuick = false;
+            QVBoxLayout *l = new QVBoxLayout;
+            l->setContentsMargins(0, 0, 0, 0);
+            m_embeddable = l;
+        }
         return static_cast<QVBoxLayout*>(m_embeddable);
     }
 
-- 
GitLab