View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#52
I've now added a webkit module and a simple webkit browser example.



Code:
import org.hildon.components 1.0
import org.hildon.webkit 1.0

Window {
    id: mainWindow

    windowTitle: qsTr("Browser")
    tools: Action {
        text: qsTr("About")
        onTriggered: dialog.open()
    }

    WebView {
        id: webView

        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
            bottom: toolbar.top
        }
    }

    ToolBar {
        id: toolbar

        anchors {
            left: parent.left
            right: parent.right
            bottom: parent.bottom
        }

        Action {
            icon: "general_backspace"
            enabled: webView.status != WebView.Null
            onTriggered: webView.back()
        }

        TextField {
            onReturnPressed: if (acceptableInput) webView.url = text
        }

        Action {
            icon: webView.status == WebView.Loading ? "general_stop" : "general_refresh"
            enabled: webView.status != WebView.Null
            onTriggered: webView.status == WebView.Loading ? webView.stop() : webView.reload()
        }
    }

    Dialog {
        id: dialog

        windowTitle: qsTr("About")
        content: Label {
            anchors.fill: parent
            wordWrap: true
            text: qsTr("Qt Components Hildon Browser is a demo of Qt Components Hildon Webkit.")
        }

        buttons: Button {
            text: qsTr("Done")
            onClicked: dialog.accept()
        }
    }
}
https://github.com/marxoft/qt-compon...ter/src/webkit

https://github.com/marxoft/qt-compon...amples/browser
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 

The Following 6 Users Say Thank You to marxian For This Useful Post: