Skip to content

Instantly share code, notes, and snippets.

@benaryorg
Created October 11, 2015 20:58
Show Gist options
  • Save benaryorg/a9a2c00a2293a7612fb2 to your computer and use it in GitHub Desktop.
Save benaryorg/a9a2c00a2293a7612fb2 to your computer and use it in GitHub Desktop.
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