import Qt 4.7 import QtWebKit 1.0 import "common" as Common Rectangle { width: 380 height: 480 //anchors.top: parent.top; anchors.bottom: parent.bottom; color: "white"; property string url: ""; Flickable { id: flickable //anchors.fill: screen; height: parent.height; width: parent.width; contentWidth: webView.width*scale; //Math.max(screen.width,webView.width*webView.scale) contentHeight: Math.max(parent.height,webView.height*webView.scale) WebView { id: webView url: "http://www.google.com"; //url: "/home/user/.feedingit/640fb167aca8bf5318ed721c5162f5eb.d/56a86b6b1675716ab54db83b1a78ab4c.html" preferredWidth: flickable.width preferredHeight: flickable.height settings.defaultFontSize: 32 scale: slider.value; //smooth: false //width: 200 //width: parent.width; height: parent.height; // Rectangle { // color: "#10000000" // anchors.fill: parent // } //onLoadFinished: {console.log("Hello"); url="javascript:void(document.body.style.background='red');" } onLoadFinished: {console.log(url);/* url="javascript:(function() { " + "document.getElementsByTagName('body')[0].style.background = 'red'; " + "})()"; console.log(url);*/ /*heuristicZoom(0,0,100)*/ } } } Common.Slider { id: slider; visible: true minimum: 0.2; maximum: 2; value: 1 property real prevScale: 1 anchors { bottom: parent.bottom; bottomMargin: 65 left: parent.left; leftMargin: 25 right: parent.right; rightMargin: 25 } onValueChanged: { if (webView.width * value > flickable.width) { var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; flickable.contentX = xoff - flickable.width/2; } if (webView.height * value > flickable.height) { var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; flickable.contentY = yoff - flickable.height/2; } prevScale = value; } Component.onCompleted: { value=0; value=1; } } }