Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to add a url to a button in qml?
Forum Updated to NodeBB v4.3 + New Features

How to add a url to a button in qml?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 5.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Naufal
    wrote on last edited by
    #1

    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!

    Regards,
    Naufal.A

    1 Reply Last reply
    0
    • F Offline
      F Offline
      favoritas37
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Naufal
        wrote on last edited by
        #3

        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!

        Regards,
        Naufal.A

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved