diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp
index b1426ea243d8cd544956f3d807d762a3828baf7c..3bc801295bd67d7302ff559ffb6ab6aaf86c6e87 100644
--- a/examples/webenginewidgets/browser/browserapplication.cpp
+++ b/examples/webenginewidgets/browser/browserapplication.cpp
@@ -116,6 +116,8 @@ static void setUserStyleSheet(QWebEngineProfile *profile, const QString &styleSh
 BrowserApplication::BrowserApplication(int &argc, char **argv)
     : QApplication(argc, argv)
     , m_localServer(0)
+    , m_privateProfile(0)
+    , m_privateBrowsing(false)
 {
     QCoreApplication::setOrganizationName(QLatin1String("Qt"));
     QCoreApplication::setApplicationName(QLatin1String("demobrowser"));
@@ -325,11 +327,8 @@ void BrowserApplication::clean()
 
 void BrowserApplication::saveSession()
 {
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-    QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
-    if (globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
+    if (m_privateBrowsing)
         return;
-#endif
 
     clean();
 
@@ -529,3 +528,24 @@ QIcon BrowserApplication::defaultIcon() const
         m_defaultIcon = QIcon(QLatin1String(":defaulticon.png"));
     return m_defaultIcon;
 }
+
+void BrowserApplication::setPrivateBrowsing(bool privateBrowsing)
+{
+    if (m_privateBrowsing == privateBrowsing)
+        return;
+    m_privateBrowsing = privateBrowsing;
+    if (privateBrowsing) {
+        if (!m_privateProfile)
+            m_privateProfile = new QWebEngineProfile(this);
+        Q_FOREACH (BrowserMainWindow* window, mainWindows()) {
+            window->tabWidget()->setProfile(m_privateProfile);
+        }
+    } else {
+        Q_FOREACH (BrowserMainWindow* window, mainWindows()) {
+            window->tabWidget()->setProfile(QWebEngineProfile::defaultProfile());
+            window->m_lastSearch = QString::null;
+            window->tabWidget()->clear();
+        }
+    }
+    emit privateBrowsingChanged(privateBrowsing);
+}
diff --git a/examples/webenginewidgets/browser/browserapplication.h b/examples/webenginewidgets/browser/browserapplication.h
index 97df0e431d0535a66290d804aa6a727103cf2e97..26557b8f9ab997f3c2cdf34821ec4dc48bc09b53 100644
--- a/examples/webenginewidgets/browser/browserapplication.h
+++ b/examples/webenginewidgets/browser/browserapplication.h
@@ -52,6 +52,7 @@
 QT_BEGIN_NAMESPACE
 class QLocalServer;
 class QNetworkAccessManager;
+class QWebEngineProfile;
 QT_END_NAMESPACE
 
 class BookmarksManager;
@@ -77,6 +78,7 @@ public:
 
     void saveSession();
     bool canRestoreSession() const;
+    bool privateBrowsing() const { return m_privateBrowsing; }
 
     static HistoryManager *historyManager();
     static CookieJar *cookieJar();
@@ -95,6 +97,10 @@ public slots:
     void lastWindowClosed();
     void quitBrowser();
 #endif
+    void setPrivateBrowsing(bool);
+
+signals:
+    void privateBrowsingChanged(bool);
 
 private slots:
     void postLaunch();
@@ -113,6 +119,8 @@ private:
     QList<QPointer<BrowserMainWindow> > m_mainWindows;
     QLocalServer *m_localServer;
     QByteArray m_lastSession;
+    QWebEngineProfile *m_privateProfile;
+    bool m_privateBrowsing;
     mutable QIcon m_defaultIcon;
 };
 
diff --git a/examples/webenginewidgets/browser/browsermainwindow.cpp b/examples/webenginewidgets/browser/browsermainwindow.cpp
index 98f61d6cb76e14c4cd24cbd01ee422c27f18f4b5..9595ca7baa00a105251e22c805ba880a44844464 100644
--- a/examples/webenginewidgets/browser/browsermainwindow.cpp
+++ b/examples/webenginewidgets/browser/browsermainwindow.cpp
@@ -68,6 +68,7 @@
 #include <QtWidgets/QInputDialog>
 
 #include <QWebEngineHistory>
+#include <QWebEngineProfile>
 #include <QWebEngineSettings>
 
 #include <QtCore/QDebug>
@@ -304,11 +305,11 @@ void BrowserMainWindow::setupMenu()
     fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print);
     fileMenu->addSeparator();
 #endif
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
     QAction *action = fileMenu->addAction(tr("Private &Browsing..."), this, SLOT(slotPrivateBrowsing()));
     action->setCheckable(true);
+    action->setChecked(BrowserApplication::instance()->privateBrowsing());
+    connect(BrowserApplication::instance(), SIGNAL(privateBrowsingChanged(bool)), action, SLOT(setChecked(bool)));
     fileMenu->addSeparator();
-#endif
 
 #if defined(Q_OS_OSX)
     fileMenu->addAction(tr("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q));
@@ -703,12 +704,11 @@ void BrowserMainWindow::printRequested(QWebEngineFrame *frame)
 
 void BrowserMainWindow::slotPrivateBrowsing()
 {
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-    QWebEngineSettings *settings = QWebEngineSettings::globalSettings();
-    bool pb = settings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled);
-    if (!pb) {
+    if (!BrowserApplication::instance()->privateBrowsing()) {
         QString title = tr("Are you sure you want to turn on private browsing?");
-        QString text = tr("<b>%1</b><br><br>When private browsing in turned on,"
+        QString text = tr("<b>%1</b><br><br>"
+            "This action will reload all open tabs.<br>"
+            "When private browsing in turned on,"
             " webpages are not added to the history,"
             " items are automatically removed from the Downloads window," \
             " new cookies are not stored, current cookies can't be accessed," \
@@ -720,20 +720,13 @@ void BrowserMainWindow::slotPrivateBrowsing()
         QMessageBox::StandardButton button = QMessageBox::question(this, QString(), text,
                                QMessageBox::Ok | QMessageBox::Cancel,
                                QMessageBox::Ok);
-        if (button == QMessageBox::Ok) {
-            settings->setAttribute(QWebEngineSettings::PrivateBrowsingEnabled, true);
-        }
-    } else {
-        settings->setAttribute(QWebEngineSettings::PrivateBrowsingEnabled, false);
 
-        QList<BrowserMainWindow*> windows = BrowserApplication::instance()->mainWindows();
-        for (int i = 0; i < windows.count(); ++i) {
-            BrowserMainWindow *window = windows.at(i);
-            window->m_lastSearch = QString::null;
-            window->tabWidget()->clear();
-        }
+        if (button == QMessageBox::Ok)
+            BrowserApplication::instance()->setPrivateBrowsing(true);
+    } else {
+        // TODO: Also ask here
+        BrowserApplication::instance()->setPrivateBrowsing(false);
     }
-#endif
 }
 
 void BrowserMainWindow::closeEvent(QCloseEvent *event)
diff --git a/examples/webenginewidgets/browser/browsermainwindow.h b/examples/webenginewidgets/browser/browsermainwindow.h
index 8315047009ad20a9bcad400845903579561efe71..a2bbc443f9aae67e9f4c6591a1b66441a042efc1 100644
--- a/examples/webenginewidgets/browser/browsermainwindow.h
+++ b/examples/webenginewidgets/browser/browsermainwindow.h
@@ -170,6 +170,7 @@ private:
     QIcon m_stopIcon;
 
     QString m_lastSearch;
+    friend class BrowserApplication;
 };
 
 #endif // BROWSERMAINWINDOW_H
diff --git a/examples/webenginewidgets/browser/downloadmanager.cpp b/examples/webenginewidgets/browser/downloadmanager.cpp
index 9609589d78b2148383e0c8f6a4898a24b8c07f53..90b0cec9d400cd1c6dd286b375c4a6bcdb4b9bb8 100644
--- a/examples/webenginewidgets/browser/downloadmanager.cpp
+++ b/examples/webenginewidgets/browser/downloadmanager.cpp
@@ -352,12 +352,9 @@ void DownloadManager::updateRow()
     downloadsView->setRowHeight(row, widget->minimumSizeHint().height());
 
     bool remove = false;
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-    QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
     if (!widget->downloading()
-        && globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
+        && BrowserApplication::instance()->privateBrowsing())
         remove = true;
-#endif
 
     if (widget->downloadedSuccessfully()
         && removePolicy() == DownloadManager::SuccessFullDownload) {
diff --git a/examples/webenginewidgets/browser/history.cpp b/examples/webenginewidgets/browser/history.cpp
index ffae0f55e12ae3022dddd47ad1120737fe518d8a..d9d76cd294f82c711b71d6dd38b0b298cc500022 100644
--- a/examples/webenginewidgets/browser/history.cpp
+++ b/examples/webenginewidgets/browser/history.cpp
@@ -189,11 +189,8 @@ void HistoryManager::checkForExpired()
 
 void HistoryManager::addHistoryItem(const HistoryItem &item)
 {
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-    QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
-    if (globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
+    if (BrowserApplication::instance()->privateBrowsing())
         return;
-#endif
 
     m_history.prepend(item);
     emit entryAdded(item);
diff --git a/examples/webenginewidgets/browser/history.h b/examples/webenginewidgets/browser/history.h
index 5a747c942a1dc7b4483e562da1813dbdd9c6c552..3519d31b67198419cf232f274692679e5d8dd6d2 100644
--- a/examples/webenginewidgets/browser/history.h
+++ b/examples/webenginewidgets/browser/history.h
@@ -81,6 +81,7 @@ class AutoSaver;
 class HistoryModel;
 class HistoryFilterModel;
 class HistoryTreeModel;
+
 class HistoryManager
 #if defined(QWEBENGINEHISTORYINTERFACE)
  : public QWebEngineHistoryInterface
diff --git a/examples/webenginewidgets/browser/tabwidget.cpp b/examples/webenginewidgets/browser/tabwidget.cpp
index 06ff59ac34c8b0d38edd6e7767f1eca56c27a2de..3df1628e011e8e702b82344554fb604506b53ad0 100644
--- a/examples/webenginewidgets/browser/tabwidget.cpp
+++ b/examples/webenginewidgets/browser/tabwidget.cpp
@@ -217,6 +217,7 @@ TabWidget::TabWidget(QWidget *parent)
     , m_lineEditCompleter(0)
     , m_lineEdits(0)
     , m_tabBar(new TabBar(this))
+    , m_profile(QWebEngineProfile::defaultProfile())
 {
     setElideMode(Qt::ElideRight);
 
@@ -456,6 +457,7 @@ WebView *TabWidget::newTab(bool makeCurrent)
 
     // webview
     WebView *webView = new WebView;
+    webView->setPage(new WebPage(m_profile, webView));
     urlLineEdit->setWebView(webView);
     connect(webView, SIGNAL(loadStarted()),
             this, SLOT(webViewLoadStarted()));
@@ -581,11 +583,7 @@ void TabWidget::closeTab(int index)
 #endif
         hasFocus = tab->hasFocus();
 
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-        QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
-        if (!globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
-#endif
-        {
+        if (m_profile == QWebEngineProfile::defaultProfile()) {
             m_recentlyClosedTabsAction->setEnabled(true);
             m_recentlyClosedTabs.prepend(tab->url());
             if (m_recentlyClosedTabs.size() >= TabWidget::m_recentlyClosedTabsSize)
@@ -605,6 +603,19 @@ void TabWidget::closeTab(int index)
         emit lastTabClosed();
 }
 
+void TabWidget::setProfile(QWebEngineProfile *profile)
+{
+    m_profile = profile;
+    for (int i = 0; i < count(); ++i) {
+        QWidget *tabWidget = widget(i);
+        if (WebView *tab = qobject_cast<WebView*>(tabWidget)) {
+            WebPage* webPage = new WebPage(m_profile, tab);
+            webPage->load(tab->page()->url());
+            tab->setPage(webPage);
+        }
+    }
+}
+
 void TabWidget::webViewLoadStarted()
 {
     WebView *webView = qobject_cast<WebView*>(sender());
diff --git a/examples/webenginewidgets/browser/tabwidget.h b/examples/webenginewidgets/browser/tabwidget.h
index 74e98f46cf567069dcd435b2f15f0d8be3ea244c..5d7f1e2c55abded27fbbf2573b583e80678bd089 100644
--- a/examples/webenginewidgets/browser/tabwidget.h
+++ b/examples/webenginewidgets/browser/tabwidget.h
@@ -48,6 +48,7 @@
 
 QT_BEGIN_NAMESPACE
 class QWebEngineDownloadItem;
+class QWebEngineProfile;
 QT_END_NAMESPACE
 
 /*
@@ -182,6 +183,8 @@ public:
     QByteArray saveState() const;
     bool restoreState(const QByteArray &state);
 
+    void setProfile(QWebEngineProfile *profile);
+
 protected:
     void mouseDoubleClickEvent(QMouseEvent *event);
     void contextMenuEvent(QContextMenuEvent *event);
@@ -226,6 +229,7 @@ private:
     QCompleter *m_lineEditCompleter;
     QStackedWidget *m_lineEdits;
     TabBar *m_tabBar;
+    QWebEngineProfile *m_profile;
 };
 
 #endif // TABWIDGET_H
diff --git a/examples/webenginewidgets/browser/toolbarsearch.cpp b/examples/webenginewidgets/browser/toolbarsearch.cpp
index fa6e4f2396836e8bac0c49a65749a444ff62d458..42cdaec1857bf03d7b98551ad3b41616cfb9eaa8 100644
--- a/examples/webenginewidgets/browser/toolbarsearch.cpp
+++ b/examples/webenginewidgets/browser/toolbarsearch.cpp
@@ -41,6 +41,7 @@
 
 #include "toolbarsearch.h"
 #include "autosaver.h"
+#include "browserapplication.h"
 
 #include <QtCore/QSettings>
 #include <QtCore/QUrl>
@@ -109,11 +110,7 @@ void ToolbarSearch::searchNow()
     if (newList.size() >= m_maxSavedSearches)
         newList.removeLast();
 
-#if defined(QTWEBENGINE_PRIVATEBROWSING)
-    QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
-    if (!globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
-#endif
-    {
+    if (!BrowserApplication::instance()->privateBrowsing()) {
         m_stringListModel->setStringList(newList);
         m_autosaver->changeOccurred();
     }
diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp
index 6f503a3a2c8373ee0870f233b3a97b04326f449d..99986642e203745ab2ecd6a10e4f3a92680b424c 100644
--- a/examples/webenginewidgets/browser/webview.cpp
+++ b/examples/webenginewidgets/browser/webview.cpp
@@ -68,8 +68,8 @@
 #include <QtCore/QDebug>
 #include <QtCore/QBuffer>
 
-WebPage::WebPage(QObject *parent)
-    : QWebEnginePage(parent)
+WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
+    : QWebEnginePage(profile, parent)
     , m_keyboardModifiers(Qt::NoModifier)
     , m_pressedButtons(Qt::NoButton)
     , m_openInNewTab(false)
@@ -129,10 +129,11 @@ bool WebPage::certificateError(const QWebEngineCertificateError &error)
 class PopupWindow : public QWidget {
     Q_OBJECT
 public:
-    PopupWindow()
+    PopupWindow(QWebEngineProfile *profile)
         : m_addressBar(new QLineEdit(this))
         , m_view(new WebView(this))
     {
+        m_view->setPage(new WebPage(profile, m_view));
         QVBoxLayout *layout = new QVBoxLayout;
         layout->setMargin(0);
         setLayout(layout);
@@ -182,7 +183,7 @@ QWebEnginePage *WebPage::createWindow(QWebEnginePage::WebWindowType type)
         BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
         return mainWindow->currentTab()->page();
     } else {
-        PopupWindow *popup = new PopupWindow;
+        PopupWindow *popup = new PopupWindow(profile());
         popup->setAttribute(Qt::WA_DeleteOnClose);
         popup->show();
         return popup->page();
@@ -306,18 +307,25 @@ void WebPage::proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator
 WebView::WebView(QWidget* parent)
     : QWebEngineView(parent)
     , m_progress(0)
-    , m_page(new WebPage(this))
+    , m_page(0)
     , m_iconReply(0)
 {
-    setPage(m_page);
-#if defined(QWEBENGINEPAGE_STATUSBARMESSAGE)
-    connect(page(), SIGNAL(statusBarMessage(QString)),
-            SLOT(setStatusBarText(QString)));
-#endif
     connect(this, SIGNAL(loadProgress(int)),
             this, SLOT(setProgress(int)));
     connect(this, SIGNAL(loadFinished(bool)),
             this, SLOT(loadFinished(bool)));
+}
+
+void WebView::setPage(WebPage *_page)
+{
+    if (m_page)
+        m_page->deleteLater();
+    m_page = _page;
+    QWebEngineView::setPage(_page);
+#if defined(QWEBENGINEPAGE_STATUSBARMESSAGE)
+    connect(page(), SIGNAL(statusBarMessage(QString)),
+            SLOT(setStatusBarText(QString)));
+#endif
     connect(page(), SIGNAL(loadingUrl(QUrl)),
             this, SIGNAL(urlChanged(QUrl)));
     connect(page(), SIGNAL(iconUrlChanged(QUrl)),
@@ -326,7 +334,6 @@ WebView::WebView(QWidget* parent)
 #if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT)
     page()->setForwardUnsupportedContent(true);
 #endif
-
 }
 
 void WebView::contextMenuEvent(QContextMenuEvent *event)
diff --git a/examples/webenginewidgets/browser/webview.h b/examples/webenginewidgets/browser/webview.h
index e694d50ac5e8431c027b707002f412dee3c0e966..a147d780a5659a5f93d77b5511ad84f4476fbba7 100644
--- a/examples/webenginewidgets/browser/webview.h
+++ b/examples/webenginewidgets/browser/webview.h
@@ -61,7 +61,7 @@ signals:
     void loadingUrl(const QUrl &url);
 
 public:
-    WebPage(QObject *parent = 0);
+    WebPage(QWebEngineProfile *profile, QObject *parent = 0);
     BrowserMainWindow *mainWindow();
 
 protected:
@@ -95,6 +95,7 @@ class WebView : public QWebEngineView {
 public:
     WebView(QWidget *parent = 0);
     WebPage *webPage() const { return m_page; }
+    void setPage(WebPage *page);
 
     void loadUrl(const QUrl &url);
     QUrl url() const;