summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlvisual/webview/flickable/flickweb.qml
blob: 6063226370c3c4f5a614bc0dd787861071029ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import QtQuick 1.0
import QtWebKit 1.0

Flickable {
    id: flickable
    width: 320
    height:  200
    contentWidth: Math.max(flickable.width,webView.width)
    contentHeight: Math.max(flickable.height,webView.height)
    pressDelay: 100

    WebView {
        id: webView
        transformOrigin: Item.TopLeft
        smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions
        url:  "test.html"
        preferredWidth: flickable.width
        preferredHeight: flickable.height
        contentsScale: 1
        onContentsSizeChanged: {
            // zoom out
            contentsScale = Math.min(1,flickable.width / contentsSize.width)
        }
    }

    Rectangle {
        id: button
        width: 50; height: 50; color: "red"
        MouseArea {
            anchors.fill: parent
            onPressed: button.color = "blue"
            onReleased: button.color = "green"
        }
    }
}