Home | History | Annotate | Download | only in resources
      1 // Demonstrates opening new WebViews from HTML
      2 
      3 import QtQuick 1.0
      4 import QtWebKit 1.0
      5 
      6 Grid {
      7     columns: 3
      8     id: pages
      9     height: 300; width: 600
     10     property int total: 0
     11 
     12     Component {
     13         id: webViewPage
     14         Rectangle {
     15             width: webView.width
     16             height: webView.height
     17             border.color: "gray"
     18 
     19             WebView {
     20                 id: webView
     21                 width: 150 // force predictable for test
     22                 newWindowComponent: webViewPage
     23                 newWindowParent: pages
     24                 url: "newwindows.html"
     25                 Timer {
     26                     interval: 10; running: total<4; repeat: false;
     27                     onTriggered: { if (webView.status==WebView.Ready) { total++; webView.evaluateJavaScript("clickTheLink()") } }
     28                 }
     29             }
     30         }
     31     }
     32 
     33     Loader { sourceComponent: webViewPage }
     34 }
     35