How to add a url to a button in qml?
-
Hi All,
I have developed an application where i want to add the external url which when clicked should be displayed. "I have checked this link":http://doc.qt.nokia.com/4.7-snapshot/qml-webview.html
but could not find any solution!!!
This is my code which i have tried
@ onButtonClicked: {
if (currentPage != "Button")
Handler.pushPage("Button")currentPage = "Button" header.headerText = "Button" stateIndexProperty = 2 Qt.openUrlExternally("http://www.naukri.com"); showPlainListView() }@
where this showPlainListView sends the signal and has click event in its resp in thier qml
Thanks for any solution!
-
You want to show the link in your application? Or do you want to redirect the user to the URL using the default browser for the phone?
To show the link from within your application, you add a "WebView":http://doc.qt.nokia.com/4.7-snapshot/qml-webview.html and set the url to the url you want to display.
On the other hand if you use the Qt.openUrlExternally(...) it will minimize your application and it will open the user with the default browser of the device.
These are the 2 options, choose which fits you best.
And a small note here, i haven't really understood your explanation regarding the showPlainListView and why this is related to your problem.
Regards.
-
Hi,
I have tried your 1 option where this is the code i have used in my code.
@ QWebView *view = new QWebView();
view->load(QUrl("http://www.naukri.com"));
view->show();@As a function call from QML.I can open the link fully in a separate widget and not inside my application.And there is only exit button which is closing the application.
So what i need is to open the web url inside my application with back button which manipulates to home page.Thanks for any Replies!