title: QWebEngineView Open In External Browser
body: <p>I'm in the process of moving my code from QtWebKit to QtWebEngine. In general, the transition has been fairly smooth, however, I'm stuck on one particular issue. I use a QWebEngineView to display a Google Maps page. Some of the markers placed have have infowindows that pop up "Click Here for More Information" which opens the link in an external browser.</p>
  
  <p>Using QtWebKit, this was fairly easy through the setLinkDelegation policy. However, it seems a little more complex here. I've tried to follow the example but somehow I need to redefine QWebEnginePage within QWebEngineView. Below is what I've come up with so far. Any idea how I can actually connect this all up?</p>
  
  <p>Thanks</p>
  
  <pre><code>#ifndef MYQWEBENGINEVIEW_H
  #define MYQWEBENGINEVIEW_H
  
  #include &lt;QWebEngineView&gt;
  #include &lt;QDesktopServices&gt;
  
  class MyQWebEnginePage : public QWebEnginePage
  {
      Q_OBJECT
  
  public:
      MyQWebEnginePage(QObject* parent = 0) : QWebEnginePage(parent){}
  
      bool acceptNavigationRequest(const QUrl &amp; url, QWebEnginePage::NavigationType type, bool isMainFrame)
      {
           qDebug() &lt;&lt; "acceptNavigationRequest("&lt;&lt;url &lt;&lt; "," &lt;&lt; type &lt;&lt; "," &lt;&lt; isMainFrame&lt;&lt;")";
  
          if (type == QWebEnginePage::NavigationTypeLinkClicked)
          {
              QDesktopServices::openUrl(url);
              return false;
          }
          return true;
      }
  };
  
  
  class MyQWebEngineView : public QWebEngineView
  {
      Q_OBJECT
  public:
      MyQWebEngineView(QWidget* parent = 0);
      MyQWebEnginePage* page() const;
  
  };
  
  #endif // MYQWEBENGINEVIEW_H
  </code></pre>