Created
October 11, 2015 20:58
-
-
Save benaryorg/a9a2c00a2293a7612fb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
import QtWebKit 3.0 | |
import QtQuick.Controls 1.0 | |
ApplicationWindow | |
{ | |
width: 640 | |
height: 400 | |
TextField | |
{ | |
id: urledit | |
visible: false | |
anchors.left: parent.left | |
anchors.right: parent.right | |
anchors.top: parent.top | |
onAccepted: | |
{ | |
console.log(webview.url=/https?:\/\/.+/.test(text)?text:"http://"+text); | |
visible = false; | |
} | |
} | |
Action | |
{ | |
shortcut: "Ctrl+O" | |
onTriggered: | |
{ | |
urledit.text = webview.url; | |
urledit.visible = true; | |
urledit.focus = true; | |
} | |
} | |
WebView | |
{ | |
id: webview | |
url: "http://ddg.gg" | |
anchors.left: parent.left | |
anchors.right: parent.right | |
anchors.bottom: parent.bottom | |
anchors.top: urledit.visible ? urledit.bottom : parent.top | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment