main.qml
import QtQuick 1.0
import QtWebKit 1.0
Rectangle {
id:main
width: 1280
height: 800
Button{
id: button
height: 50
width: 100
anchors.centerIn: parent
onButtonClicked: {
console.log("Mouse was clicked");
brow.visible = true;
brow.urlString = "some url with flash plugin";
console.log("url:",brow.urlString);
}
}
WebBrowser{
id: brow
visible: false
}
}
WebBrowser.qml:
import QtQuick 1.1
import QtWebKit 1.0
Rectangle
{
id: webTray
width: 1280
height: 800
property string urlString: ""
Button
{
id: callaccept
y: 0.01*webTray.height
anchors.right: webTray.right;
anchors.rightMargin: 0.05*webTray.width
displayText: "Quit";
width: 0.05*webTray.width;
height: 0.04*webTray.height;
onClicked:
{
console.log("clicked on quit");
brow.visible = false;
brow.urlString = ""
console.log("browser is visible?:",brow.visible);
}
}
Rectangle
{
width: webTray.width;
height: 2;
color: "silver";
anchors.bottom: web.top;
}
height: 50
width: 100
anchors.centerIn: parent
onButtonClicked: {
WebView
{
id: web
preferredWidth: webTray.width
preferredHeight: webTray.height - 0.06*webTray.height;
y: 0.06*webTray.height
transformOrigin: Item.TopLeft
settings.pluginsEnabled: true
url: webTray.urlString
smooth: false
onAlert: console.log(message)
}
}