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

HttpNetworkActivityIndicator

Convenience type to check pending requests when using HttpRequest. More...

Import Statement: import Felgo 3.0
Since: Felgo 2.18.1

Properties

Detailed Description

This item exposes properties that can be used to show an indicator when there are outstanding network requests in the application. There is a native implementation for iOS and there is also a generic implementation that works on all platforms (including iOS).

Only network request created by HttpRequest are considered.

The component is available as a singleton item and usable from all QML components that import Felgo via import Felgo 3.0.

Example Usage

 import Felgo 3.0
 import QtQuick 2.0

 App {

   Component.onCompleted: {
     // remove activation delay to immediately show the indicator for requests
     // otherwise, requests that take less than the default 150 ms won't trigger the indicator
     HttpNetworkActivityIndicator.activationDelay = 0
   }

   NavigationStack {
     Page {
       title: "Network Activity Example"
       rightBarItem: ActivityIndicatorBarItem {
         animating: HttpNetworkActivityIndicator.enabled
         visible: animating
       }

       AppButton {
         text: "Send Get Request"
         anchors.centerIn: parent
         onClicked: {
           HttpRequest
             .get("http://httpbin.org/get")
             .then(function(res) {
               console.log(JSON.stringify(res.body))
             })
             .catch(function(err) {
               console.log(err.message)
             });
         }
       }
     }
   }
 }

Property Documentation

activationDelay : int

Time (in ms) to wait before enabling the network activity indicator after new requests have been initiated. The default is 1000 ms.


completionDelay : int

Time (in ms) to wait before disabling the network activity indicator after all requests have completed. The default is 170 ms.


enableNativeIndicator : int

A property that indicates if the native implementation of the activity indicator should be used. This feature is only available on iOS. The default value of this property is false.


enabled : bool

A read-only property that is true when Duperagent has a non-zero number of pending network requests. It can be used to show a busy indicator or some other visual element to indicate that something is happening.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded