HttpNetworkActivityIndicator

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

Import Statement: import VPlayApps 1.0
Since: V-Play 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 V-Play via import VPlayApps 1.0.

Example Usage

 import VPlayApps 1.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.


Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support