Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › How to use AppActivityIndicator while downloading data from Internet

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18133

    Niyazi

    Hi,

    I want to use Felgo AppActivityIndicator when my app downloads some data from Internet.

    When my app starts its get some json data from internet using  Component.onCompleted: { }. After user needs new data he7she can activate  AppActivityIndicator icon to get new data. While is geting new data I need to activate AppActivityIndicator  animation and when download completse I need to stop the AppActivityIndicator  animation

    How do I do that?  I couldn’t find any example for that. Any help please.

    #18143

    Alex
    Felgo Team

    Hi,

    the AppActivityIndicator has the methods startAnimating() and stopAnimating(). Depending on how you get your data, you can start the indicator when requesting your data and stop the indicator when you received your data?

    For an xmlhttprequest this could look something like this:

    function loadJsonData() {
         var xhr = new XMLHttpRequest
         xhr.onreadystatechange = function() {
           if (xhr.readyState === XMLHttpRequest.DONE) {
             var dataString = xhr.responseText
             app.jsonData = JSON.parse(dataString)
             indicator.stopAnimating()
           }
         }
         xhr.open("GET", "your-url")
         xhr.send()
         indicator.startAnimating()
       }

    Cheers,
    Alex

    #18145

    Niyazi

    Thanx Alex, I will update my code.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded