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: "http://www.viedemerde.fr/inclassable/5873986?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+viedemerde+%28Vie+de+merde%29" url: "/home/ymarcoz/.feedingit/361f6abe590be9c681b5489e5d48331c.d/1b1033c75378fb19a8a70151d764cd33.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; } } }