Hi
My Qml page is very simple: ToolButton and WebView. Now it loads background and shows nothing but white rectangle (WebView object) even toolbutton is transparent, but accessible. I can load page by hand (clicking on toolbutton). But I want open page at application start! My code is as follow:
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtWebView 1.1
import QtQuick.Layouts 1.1
Rectangle {
id: rec1
color: "black"
gradient: Gradient {
GradientStop {
position: 0.00;
color: "#000000";
}
GradientStop {
position: 1.00;
color: "#ffffff";
}
}
ToolButton {
id: reloadButton
tooltip: qsTr("Reload")
onClicked: web1.url = "http://google.pl"
}
// anchors.fill: parent
WebView {
id: web1
objectName: "web1"
visible: true
anchors.top: reloadButton.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
//anchors.fill: parent
anchors.margins: 10
url: "http://google.pl"
onLoadingChanged: {
if(loadRequest.errorString)
console.error(loadRequest.errorString);
else
console.info("Load web page successfull");
}
Component.onCompleted: function() { web1.url = "http://google.pl"; web1.reload(); console.info("Load successfull"); }
}
}
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtWebView 1.1
import QtQuick.Layouts 1.1
Rectangle {
id: rec1
color: "black"
gradient: Gradient {
GradientStop {
position: 0.00;
color: "#000000";
}
GradientStop {
position: 1.00;
color: "#ffffff";
}
}
ToolButton {
id: reloadButton
tooltip: qsTr("Reload")
onClicked: web1.url = "http://google.pl"
}
// anchors.fill: parent
WebView {
id: web1
objectName: "web1"
visible: true
anchors.top: reloadButton.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
//anchors.fill: parent
anchors.margins: 10
url: "http://google.pl"
onLoadingChanged: {
if(loadRequest.errorString)
console.error(loadRequest.errorString);
else
console.info("Load web page successfull");
}
Component.onCompleted: function() { web1.url = "http://google.pl"; web1.reload(); console.info("Load successfull"); }
}
}
To copy to clipboard, switch view to plain text mode
How to load web page just after application start?!?
thanks and best regards
Szyk Cech
Bookmarks