VisibilityRefreshHandler

A helper item for handling data reload actions as soon as the item becomes visible. More...

Import Statement: import VPlayApps 1.0
Inherits:

Item

Properties

Signals

Detailed Description

This item is a convenience item that can be added as the header or footer of an AppListView.

As soon as the item gets visible within the AppListView the refresh signal is emitted. It's then possible to take appropriate actions in your app logic. This can be used to implement infinite scrolling for apps showing a news stream or similar data.

As an example you can load the next 20 tweets in your Twitter app as soon as a user scrolls to the bottom of the feed, as shown in the following sample:

 import VPlayApps 1.0

 AppListView {
   footer: VisibilityRefreshHandler {
     onRefresh: twitterCient.loadNextTweets()
   }
 }

After all elements are displayed in a list and there is no new additional data you might want to show, set canRefresh to false to prevent showing the item any longer. If your app supports true "inifite scrolling", you can keep the default value for canRefresh (true).

The default height is 48dp and the default width is the parent width. If the VisibilityRefreshHandler is invisible, its size is set to 0.

Customize the Delegate

An AppActivityIndicator is displayed by default during the refresh.

To set a custom Item instead of the default delegate, see this example:

 import QtQuick 2.0
 import VPlayApps 1.0

 AppListView {
   footer: VisibilityRefreshHandler {

     // disable the default view
     defaultAppActivityIndicatorVisible: false

     Rectangle {
       anchors.fill: parent
       color: "grey"
       Text {
         text: "Refreshing ..."
         anchors.centerIn: parent
       }
     }

     onRefresh: twitterClient.loadNextTweets()

   }
 }

Property Documentation

canRefresh : bool

Use this property to control if the item should be shown or not within the contained AppListView.

By default the property is true. Set to false as soon as there is no more data you can load or show.

Note: Setting this property has the same effect as setting the item's Item::visible property. If the items is set to invisible, canRefresh is also set to false.

This QML property was introduced in V-Play 2.17.1.


defaultAppActivityIndicatorVisible : bool

Holds whether the default AppActivityIndicator shall be visible. By default it is true.

Set this property to false to Customize the Delegate.

This QML property was introduced in V-Play 2.6.1.


listView : ListView

The AppListView this item belongs to. This property is set automatically to the parent as soon as the item gets set as the header or footer of an AppListView.


Signal Documentation

refresh()

Emitted as soon as the item is visible due to scrolling to the very top or bottom in the contained AppListView. You can take appropriate actions to handle the data reload or load more items for your list.

See also canRefresh.


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